计算两个 Vector2 之间绕枢轴的旋转
大家好。
经过漫长的周日谷歌之后,我将不得不羞愧地低下头并提出问题......
我拥有的是一个枢轴向量2,一个“前一个”向量2和一个“当前”向量2。
我希望能够计算它们之间的弧度旋转。一个稍微复杂的事实是,枢轴可能会在先前和当前之间移动,但如果您没有时间将其纳入折叠中,则无法将偏移作为单独的问题处理。
为了澄清,一个物体有两个向量,一个枢轴和一个底座……枢轴位于中心,底座位于底部,围绕外部枢轴旋转。我需要使用提到的两个向量计算出对象本身绕其中心的旋转。
非常感谢任何可以提供帮助的人。
问题背景
我有一个游戏,其中一个对象围绕外部枢轴旋转。通过使用两个点(一个在中心,一个在对象的底部),我想计算出需要应用于围绕其中心的对象精灵的旋转,以符合已应用的较大旋转。
Hello all.
After a good long Sunday google I am going to have to hang my head in shame and ask the question...
What I have is a pivot vector2, a "Previous" vector2 and a "Current" vector2.
I would like to be able to calculate the rotation in radians between them. A slight complication is the fact that the pivot may moved between previous and current but ill deal with the offsetting as a separate issue if you don't have the time to bring that into the fold.
To clarify, an object which has two vectors, a pivot and a base ... the pivot sitting in the centre and the base at the bottom is rotated around an external pivot. I need to work out the rotation of the object itself around its centre using the two mentioned vectors.
Very big thanks to anyone that can help.
Background to problem
I have a game where an object is rotated around an external pivot. By using using two points (one in the centre, one at the base of the object) I am wanting to to work out the rotation that needs to be applied to the objects sprite around its centre to conform to the larger rotation that has been applied.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
计算向量与主元之差的叉积:
Take the cross product of the differences between the vectors and the pivot: