Graphics/Camera.cs
/// <summary>
/// Rotate around a target at a distance.
/// </summary>
/// <param name="longitude">The angle to rotate around the target from east to west</param>
/// <param name="latitude">The angle to rotate around the target from north to south</param>
/// <param name="target">The target</param>
/// <param name="distance">The distance the camera should be away from the target</param>
Rotate around a target at a distance.
Rotate around a target at a distance .
public void ArcBall(float longitude, float latitude, Vector3 target, float distance)
        {
            Transform.Position = Quaternion.FromAxisAngle(Transform.Right, latitude) *
                ((Transform.Position - target).Normalized() * distance) + target;
            Transform.Position = Quaternion.FromAxisAngle(Transform.Up, longitude) *
                ((Transform.Position - target).Normalized() * distance) + target;
            LookAt(target);
        }
public void ArcBall ( float longitude , float latitude , Vector3 target , float distance ) { Transform . Position = Quaternion . FromAxisAngle ( Transform . Right , latitude ) * ( ( Transform . Position - target ) . Normalized ( ) * distance ) + target ; Transform . Position = Quaternion . FromAxisAngle ( Transform . Up , longitude ) * ( ( Transform . Position - target ) . Normalized ( ) * distance ) + target ; LookAt ( target ) ; }
Rotate around a target at a distance.
Rotate around a target at a distance .
longitude
float
The angle to rotate around the target from east to west
The angle to rotate around the target from east to west
latitude
float
The angle to rotate around the target from north to south
The angle to rotate around the target from north to south
target
Vector3
None
distance
float
The distance the camera should be away from the target
The distance the camera should be away from the target