absoluteRotation and rotationSpeedLimit

Good evening,

I’m on new smaller approaches and got some question about it:

  1. How do I get global (absolute) Rotation of Mesh (TransformNode)? I only know how to do this with one parent but several will be inefficient by going through whole parent hierarchy and adding up all rotations. I thought about using currentParent.getWorldMatrix() and transform with rotatableMesh’s rotation, would this work and do I need to normalize?

  2. How can I limit the speed of rotation? If you want to see my approach I can share PG.

A playground would be really nice indeed as speed of rotation is only managed by your code.

Regarding the first point, absoluteRotationQuaternion would be the way to go. And calling computeWorldMatrix(true) before would help if you did change of the values in the hierarchy before.

Here is my PG approach I added your suggestion but stuck on how to connect with my roationSpeedLimit-Algorithm:

Do you need computeWorldMatrix(true), when absoluteRotationQuaternion is accessed inside scene.registerBeforeRender and rotationQuaternion is manually set (to simulate a .glb-models with rotationQuaternion?) before rendering?

Edit: I was able to solve it. Using RotateTowards from Unity.

1 Like