I have a vector in world space(e.g. let’s say it’s (0, 0, -2)). I have an object(which has orientation matrix). It has a vector in it’s local space. That vector’s local Z axis goes through the centre of it’s master object in negative direction. The vector has no orientation matrix, however, in calculations it uses axis. The axis must only use the master object’s orientation matrix, position of itself and master object.
The image should explain the problem pretty well. As you can see, I require some advanced math(not primary school - that’s why I haven’t learnt those things yet). However, I hope that somebody can help me out. Thanks!
To rotate a direction vector from local to world space (of an object)
world = obj_rot_mat * local
To rotate a direction vector from world to local space (of an object)
local = obj_rot_mat.inverted() * world
An orientation matrix (obj_rot_mat) just rotates vectors (doesn’t affect their lengths). A Transformation matrix (obj.worldTransform) will rotate and scale vectors. It’s useful when transformation position vectors from local to world space.
A position vector and direction vector is just a semantic difference. They’re both vectors but they mean subtly different things.
OK! But now, how do I get the rotation matrix if I know the world vector and world orientation, the position of point and I know that the point’s Z axis are facing right away from the centre?