I have defined an object in 3D space with position, rotation and scale values (all defined as 3D vectors). It also has upwards and forwards direction vectors. When I rotate the object, I need these direction vectors to rotate with it.
Assuming my up vector is (0, 1, 0) and my forwards vector is (0, 0, 1) at zero rotation, how might I achieve this?
You can multiply the current vector with the rotation matrix (Wikipedia entry, under ‘basic rotations’). If the rotation is in 2 or more axis, just multiply by the appropriate matrices. For example, if you rotate by 30 degrees in the X axis and 60 in the Y axis, multiply by
and then by