全球轮换
在 GLScene 中,我们有三个参数(RollAngle、PitchAngle 和 TurnAngle)用于围绕局部方向旋转。在下图中,如何围绕全局方向(橙色轴)旋转立方体?
in GLScene we have three parameters (RollAngle, PitchAngle and TurnAngle) for rotation around local orientation. in the image below, how can I rotate cube around global orientation (orange axis)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要将轴角度旋转转换为欧拉角。这是一个用代码详细解释此过程的链接:
http://www.euclideanspace.com/maths/geometry/rotations /conversions/angleToEuler/index.htm
来自文章:
编辑:重命名变量以与俯仰、偏航、滚动命名一致 习俗。
You would need to convert the axis angle rotation to Euler angles. Here is a link explaining this process in some detail with code:
http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToEuler/index.htm
From the article:
EDIT: Renamed the variables to be consistent with the pitch, yaw, roll naming convention.
也许您可以使用“DummyCube”对象作为父对象。然后你可以先旋转虚拟立方体内的立方体,然后旋转虚拟立方体。
Maybe you could use "DummyCube" object as a parent. Then you can rotate first the cube inside dummy cube and then the DummyCube.
这是一种肮脏的欺骗,但如果对象位于原点 (0,0,0) 并且场景中只有一个对象,您可以围绕对象摆动相机(和光源),而不是旋转对象。
This is a dirty cheat, but if the object is at the origin (0,0,0) and there is only one object in the scene, you could swing the camera (and light source) around the object instead of rotating the object.