/// <summary> /// Explicit Constructor. Set the Position3D object that should be affected by rotations around /// this Pivot Point. /// </summary> /// <param name="cPosition">Handle to the Position3D object to update</param> public PivotPoint3D(Position3D cPosition) { // Save a handle to the Position that this should update mcPositionData = cPosition; // Set the handle to the Orientation to null so no Orientation operations are performed mcOrientationData = null; }
/// <summary> /// Rotates the given Position and Orientation around the Pivot Point, changing the Position and Orientation /// </summary> /// <param name="sRotationMatrix">The Rotation to apply to the object</param> /// <param name="sPivotPoint">The Point to rotate the object around</param> /// <param name="srPosition">The Position of the object (to be modified)</param> /// <param name="srOrientation">The Orientation of the object (to be modified)</param> public static void RotatePositionAndOrientation(Matrix sRotationMatrix, Vector3 sPivotPoint, ref Vector3 srPosition, ref Quaternion srOrientation) { // Rotate the Orientation about it's center to change its Orientation srOrientation = Orientation3D.Rotate(sRotationMatrix, srOrientation); // Rotate the Position around the specified Pivot Point srPosition = PivotPoint3D.RotatePosition(sRotationMatrix, sPivotPoint, srPosition); }
/// <summary> /// Sets the Right direction of the given Quaternion to be the given New Right Direction. /// </summary> /// <param name="sOrientation">The Quaternion to modify.</param> /// <param name="sNewRightDirection">The New Right Direction the Quaternion should have.</param> public static void SetRightDirection(ref Quaternion sOrientation, Vector3 sNewRightDirection) { // Get the Rotation needed to make our Right face the given Direction. Quaternion sRotation = Orientation3D.GetRotationTo(Orientation3D.GetRightDirection(sOrientation), sNewRightDirection); // Rotate the object. sOrientation.Normalize(); sOrientation = sRotation * sOrientation; }
/// <summary> /// Copy the given PivotPoint3D object's data into this object's data /// </summary> /// <param name="cPivotPointToCopy">The PivotPoint3D object to copy from</param> public void CopyFrom(PivotPoint3D cPivotPointToCopy) { PivotPoint = cPivotPointToCopy.PivotPoint; PivotRotationalVelocity = cPivotPointToCopy.PivotRotationalVelocity; PivotRotationalAcceleration = cPivotPointToCopy.PivotRotationalAcceleration; mbRotateOrientationToo = cPivotPointToCopy.RotateOrientationToo; mcPositionData = new Position3D(cPivotPointToCopy.PositionData); mcOrientationData = new Orientation3D(cPivotPointToCopy.OrientationData); }
/// <summary> /// Initializes a new instance of the <see cref="ParticleEmitter"/> class. /// </summary> public ParticleEmitter() { // Initialize the Position, Orientation, and Pivot Point variables. _positionData = new Position3DWithPreviousPosition(); _orientationData = new Orientation3DWithPreviousOrientation(); _pivotPointData = new PivotPoint3D(_positionData, _orientationData); // Disable Lerping the Emitter on the first update, since the Previous Position and Orientation won't be set yet. LerpEmittersPositionAndOrientationOnNextUpdate = false; LerpEmittersPositionAndOrientation = true; // Default any other properties. Enabled = true; EmitParticlesAutomatically = true; // Assign a unique ID to this emitter. ID = _particleEmitterCount++; }
/// <summary> /// Rotates the object about its center, changing its Orientation. /// </summary> /// <param name="sRotationMatrix">The Rotation to apply to the object.</param> public void Rotate(Matrix sRotationMatrix) { // Rotate the object about it's center to change its Orientation. Orientation = Orientation3D.Rotate(sRotationMatrix, Orientation); }
/// <summary> /// Copies the given Orientation3D object's data into this object's data. /// </summary> /// <param name="cOrientationToCopy">The Orientation3D object to copy from.</param> public virtual void CopyFrom(Orientation3D cOrientationToCopy) { Orientation = cOrientationToCopy.Orientation; RotationalVelocity = cOrientationToCopy.RotationalVelocity; RotationalAcceleration = cOrientationToCopy.RotationalAcceleration; }
/// <summary> /// Copy Constructor. /// </summary> /// <param name="cOrienationToCopy">The Orienation3D object to copy.</param> public Orientation3D(Orientation3D cOrienationToCopy) { CopyFrom(cOrienationToCopy); }
/// <summary> /// Copies the given Orientation3D object's data into this object's data. /// </summary> /// <param name="orientationToCopy">The Orientation3D object to copy from.</param> public override void CopyFrom(Orientation3D orientationToCopy) { base.CopyFrom(orientationToCopy); PreviousOrientation = Orientation; UpdatePreviousOrientationAutomatically = true; }
/// <summary> /// Copy Constructor. /// </summary> /// <param name="orienationToCopy">The Orienation3D object to copy.</param> public Orientation3DWithPreviousOrientation(Orientation3D orienationToCopy) { CopyFrom(orienationToCopy); }
/// <summary> /// Explicit Constructor. Set the Position3D and Orientation3D objects that should be affected by /// rotational around this Pivot Point. /// </summary> /// <param name="cPosition">Handle to the Position3D object to update</param> /// <param name="cOrientation">Handle to the Orienetation3D object to update</param> public PivotPoint3D(Position3D cPosition, Orientation3D cOrientation) { // Save handles to the Position and Orientation that this should update mcPositionData = cPosition; mcOrientationData = cOrientation; }