How to convert a world space vector to a local space vector

Hello…

Imagine i apply a force in some object in the vector (0, 5, 0) in local coordinates. Then i know that the object starts to move in its LOOK direction in a velocity 5m/s. But now the object is moving in another vector (because it should be changed to the world coordinates). The object starts to decelerate and now i lost how is its velocity…

My question is: how can i get this object velocity on its axis instead of world coordinates? In Unity looks like there is a function for this: InverseTransformDirection is there something similar in Armory?

See the topic: https://answers.unity.com/questions/32551/how-do-i-obtain-the-local-velocity-of-a-rigid-body.html

Edit: Already found the solution here https://stackoverflow.com/questions/33031758/transform-world-space-vectors-to-local-space

It is:

localSpaceVec.x = worldSpaceVec.dot(object.transform.right());
localSpaceVec.y = worldSpaceVec.dot(object.transform.look());
localSpaceVec.z = worldSpaceVec.dot(object.transform.up());

4 Likes