Urho节点旋转

时间:2019-06-28 16:22:46

标签: quaternions urhosharp urho3d

我正在尝试围绕UrhoSharp中的点旋转对象。我已经对四元数的工作方式做了很多学习,但是他使用了node.RotateAround方法,似乎并没有遵循规则。

当w = 0或PI时,我似乎得到正确的旋转。但是,如果使用任何其他数字,我似乎无法知道对象将以哪种方式旋转。

float w = 0;//or PI
node.RotateAround(point, new Quaternion(Vector3.Up, w) , transformSpace.World);

如果有人对四元数有任何看法,我将不胜感激。

1 个答案:

答案 0 :(得分:0)

我认为,要使用该构造函数,您需要使用四元数指数映射:

 var q = new Quaternion(Math.Sin(w/2)*Vector3.Up, Math.Cos(w/2));

但是也许您想要做的是从轴和角度构造:

// note that in this constructor "w" is in degrees, not radians
var q = Quaternion.FromAxisAngle(Vector3.Up, w/2);
相关问题