public Quaternion(Angles3 angles) { float sx, cx; MathHelpers.SinCos(angles.x * 0.5f, out sx, out cx); float sy, cy; MathHelpers.SinCos(angles.y * 0.5f, out sy, out cy); float sz, cz; MathHelpers.SinCos(angles.z * 0.5f, out sz, out cz); _w = cx * cy * cz + sx * sy * sz; _v = new Vector3(cz * cy * sx - sz * sy * cx, cz * sy * cx + sz * cy * sx, sz * cy * cx - cz * sy * sx); }
/// <summary> /// x=yaw /// y=pitch /// z=roll (we ignore this element, since its not possible to convert the roll-component into a vector) /// </summary> /// <param name="ypr"></param> /// <returns></returns> public static Vector3 CreateViewdir(Angles3 ypr) { return(CCamera.CreateViewdir(ypr)); }
/// <summary> /// This function builds a 3x3 orientation matrix using YPR-angles, and converts it to a Matrix3x4 /// Rotation order for the orientation-matrix is Z-X-Y. (Zaxis=YAW / Xaxis=PITCH / Yaxis=ROLL) /// COORDINATE-SYSTEM /// z-axis /// ^ /// | /// | y-axis /// | / /// | / /// |/ /// +---------------> x-axis /// </summary> /// <param name="ypr"></param> /// <returns></returns> public static Matrix3x4 CreateOrientationYPR(Angles3 ypr) { return(new Matrix34(CCamera.CreateOrientationYPR(ypr))); }
// TODO Wrap SViewParams in a managed struct //public void SetCurrentParams (SViewParams arg0); /// <summary> /// Set the additive camera angles for this <see cref="View"/>. /// </summary> /// <param name="addFrameAngles">Add frame angles.</param> public void SetFrameAdditiveCameraAngles(Angles3 addFrameAngles) { NativeHandle.SetFrameAdditiveCameraAngles(addFrameAngles); }
/// <summary> /// Set new shake parameters for a new or existing shake on this <see cref="View"/>. /// </summary> /// <param name="shakeAngle">The angle the view will shake to.</param> /// <param name="shakeShift">The direction and magnitude of the shake.</param> /// <param name="duration">Duration of the full shake.</param> /// <param name="frequency">The time it takes for a single oscilation to complete.</param> /// <param name="randomness">Amount of randomness that's added to the shake direction and angle.</param> /// <param name="shakeId">ID of the Shake. If a shake with this ID already exists, it will be adjusted with the new parameters, otherwise a new shake is created.</param> /// <param name="flipVector">If set to <c>true</c> the direction and angle of the shake will be flipped after each oscilation.</param> /// <param name="updateOnly">If set to <c>true</c> this will only update an existing shake.</param> public void SetViewShake(Angles3 shakeAngle, Vector3 shakeShift, float duration, float frequency, float randomness, int shakeId, bool flipVector, bool updateOnly) { NativeHandle.SetViewShake(shakeAngle, shakeShift, duration, frequency, randomness, shakeId, flipVector, updateOnly); }
/// <summary> /// Set new shake parameters for a new or existing shake on this <see cref="View"/>. /// </summary> /// <param name="shakeAngle">The angle the view will shake to.</param> /// <param name="shakeShift">The direction and magnitude of the shake.</param> /// <param name="duration">Duration of the full shake.</param> /// <param name="frequency">The time it takes for a single oscilation to complete.</param> /// <param name="randomness">Amount of randomness that's added to the shake direction and angle.</param> /// <param name="shakeId">ID of the Shake. If a shake with this ID already exists, it will be adjusted with the new parameters, otherwise a new shake is created.</param> public void SetViewShake(Angles3 shakeAngle, Vector3 shakeShift, float duration, float frequency, float randomness, int shakeId) { NativeHandle.SetViewShake(shakeAngle, shakeShift, duration, frequency, randomness, shakeId); }
public static Quaternion CreateRotationXYZ(Angles3 angles) { return(new Quaternion(angles)); }
public Rotation(Vector3 rot) { _rotation = rot; }
public Rotation() { _rotation = new Vector3(0, 0, 0); }