本文整理汇总了C#中Quaternion.RotateVector方法的典型用法代码示例。如果您正苦于以下问题:C# Quaternion.RotateVector方法的具体用法?C# Quaternion.RotateVector怎么用?C# Quaternion.RotateVector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quaternion
的用法示例。
在下文中一共展示了Quaternion.RotateVector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Quat_Generic_Vector_Multiplication_Against_Unity
public static void Test_Quat_Generic_Vector_Multiplication_Against_Unity(float a, float b, float c, float d)
{
//arrange
Quaternion<float> genericQuat = new Quaternion<float>(a, b, c, d);
Vector3<float> genericVec3 = new Vector3<float>(b, c, d);
//arrange
UnityEngine.Quaternion unityQuat = new UnityEngine.Quaternion(a, b, c, d);
UnityEngine.Vector3 unityVec3 = new UnityEngine.Vector3(b, c, d);
//act
Vector3<float> genericResultVec3 = genericQuat.RotateVector(genericVec3);
UnityEngine.Vector3 unityResultVec3 = unityQuat * unityVec3;
//assert
for (int i = 0; i < 3; i++)
//for Vector3 I rewrote the code so that it mostly matched UnityEngine after JIT values, not that I looked at the JIT compiled code but the values matched
//after changing it. However, for some reason these do not line up like before. Operator overloads aren't equivalent to methods and something is happening
//to make this not equivalent even though it's the same exact floating point math C# code.
Assert.AreEqual(genericResultVec3[i], unityResultVec3[i], Math.Abs((((int)unityResultVec3[i]) * Vector3<float>.kEpsilon)));
}