private void PanCamera(float deltaX, float deltaY) { var cameraOrientation = QuaternionUtility.CreateFromYawPitchRoll_ZUp( _yaw, _pitch, 0); _translation += Vector3.Transform(-Vector3.UnitX, cameraOrientation) * deltaX * PanSpeed; _translation += Vector3.Transform(Vector3.UnitZ, cameraOrientation) * deltaY * PanSpeed; }
private void UpdateCamera() { var position = Vector3.Transform( -Vector3.UnitY, QuaternionUtility.CreateFromYawPitchRoll_ZUp(_yaw, _pitch, 0)); position *= _zoom * _radius; position += _target; Entity.Transform.LocalPosition = position + _translation; Entity.Transform.LookAt(_target + _translation); }
private void PanCamera(float deltaX, float deltaY) { var cameraOrientation = QuaternionUtility.CreateFromYawPitchRoll_ZUp( _yaw, DefaultPitch, 0); var panSpeed = PanSpeed * _zoom; var newTranslation = Vector3.Zero; newTranslation += Vector3.Transform(-Vector3.UnitX, cameraOrientation) * deltaX * panSpeed; newTranslation += Vector3.Transform(Vector3.UnitZ, cameraOrientation) * deltaY * panSpeed; newTranslation.Z = 0; _translation += newTranslation; }
public static void MoveCameraTo(ScriptExecutionContext context, [ScriptArgumentType(ScriptArgumentType.WaypointName)] string cameraName, float rawDuration, float shutter, float easeIn, float easeOut) { var camera = context.Scene.Cameras[cameraName]; var targetPoint = camera.LookAtPoint; var duration = TimeSpan.FromSeconds(rawDuration); var animation = context.Scene.CameraController.StartAnimation( new[] { context.Scene.CameraController.TerrainPosition, targetPoint }, context.UpdateTime.TotalTime, duration); var rotation = QuaternionUtility.CreateFromYawPitchRoll_ZUp(camera.Yaw, 0, camera.Roll); var lookToward = Vector3.Transform(Vector3.UnitY, rotation); animation.SetFinalLookDirection(lookToward); animation.SetFinalPitchAngle(-camera.Pitch); animation.SetFinalZoom(camera.Zoom); animation.SetFinalFieldOfView(camera.FieldOfView); }