Pick and aim

Packages

  • Nuget (with prereleases)
  • Nuget (with prereleases)

Physics/Input/Transform Extensions

Pick and aim at an Entity:

if (Input.IsMouseButtonPressed(Stride.Input.MouseButton.Left))
{   
    var ray = MainCamera.ScreenToWorldRaySegment(Input.MousePosition);

    var hitResult = this.GetSimulation().Raycast(ray);
    if (hitResult.Succeeded)
    {
        target = hitResult.Collider.Entity;
    }
}

if(target != null)
{
    MainCamera.Entity.Transform.LookAt(target.Transform, Game.GetDeltaTime() * 3.0f);
}