public Camera(Vector3 position, Vector3 lookat, Vector3 up) { Up = up.Normalise(); Position = position; LookAt = lookat; Equator = Vector3.Cross(LookAt.Normalise(), Up); Screen = Position + LookAt; }
/// <summary> /// Calculates the multiplier for the kart to steer towards the next waypoint /// </summary> /// <param name="vecToTar">the next waypoint position - the current kart position</param> /// <returns>A float between -1 and 1, inclusive</returns> private float SteerTowards(Vector3 vecToTar) { Vector3 xaxis = Kart.ActualOrientation.XAxis; xaxis.Normalise(); vecToTar.Normalise(); float result = xaxis.DotProduct(vecToTar); if (result < -1) return -1; else if (result > 1) return 1; else return result; }
public Ray(Vector3 origin, Vector3 direction) { Origin = origin; Direction = direction.Normalise(); }