Howto Rotate Entity around World Origin

Using the Entity.Transform.Rotation and all the possible Quaternion factories, it seems though that I can only change rotation relative to the entities local coordinate system (is that right or did i miss something?).

I also tried to retrieve the entitie’s world matrix, apply rotation and write it back, but this has no effect (it’s ignored though it’s not read only)?

From the resulting matrix I can however retrieve the translation vector and i can build the rotation quaternion, however it seems a bit costly to do all of this step by step?

So I wonder if there is a built in helper to rotate an entity around the world origin or any other more efficient way (or should I just not bother)?

Hello, i know two possible solutions for your problem.
First is using the orbital rotation principle. For this, create a sphere (or any other 3d procedural object) and name it Orb, move the position of the Orb to the center of your rotation (in this case, the origin of world position) and make the entity you want rotate a child of the Orb. Now, when you rotate the Orb, you will rotate the entity around the position of orb. My character controller use this principle to vertical rotation of camera:

The second solution, is using the rotation code present in the documentation “how to’s”, here is the link:
http://doc.paradox3d.net/1.2/?page=HOWTO%3A+Use+scripts

Hi there,

thanks for your input. Yeah, i also noticed that just using a parent object is a simple solution.
The example code you mention just rotates around the local system. I still think it would be a nice addition to have readily available helper methods for rotations around different vector origins than just the objects local system. Then again I really don’t know enough about quaternions and 3d math to see whether what i do in code now is more or less just the same than what parenting in the studio produces in math load.
I need to keep looking deeper into all this stuff :relaxed:

Ed: Also turned out that setting the World/LocalMatrix property is indeed pointless, it’s ignored (should be readonly type or private setter i guess). In any case it’s great to have the source code available to just quickly look up stuff like that.