I have 2 cubes[cube1, cube2] which are in their own local coordinate system. I want to rotate cube1 such that it is centered at a vertex of cube2 and rotating in the direction this vertex normal[of cube2].
I have done something like this:
- Transform the vertex position of cube2 to world space.
- Transform the normal’s axis at this vertex position to world space.
- Normalize this vector.
- Translate to the transformed vertex position.
- Rotate along this transformed axis.
Is this right ? Any suggestions would be appreciated.