darkcoder

10-28-2014, 07:51 PM

Hi,

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:

1. Transform the vertex position of cube2 to world space.

2. Transform the normal's axis at this vertex position to world space.

3. Normalize this vector.

4. Translate to the transformed vertex position.

5. Rotate along this transformed axis.

Is this right ? Any suggestions would be appreciated.

Thanks.

DarkCoder

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:

1. Transform the vertex position of cube2 to world space.

2. Transform the normal's axis at this vertex position to world space.

3. Normalize this vector.

4. Translate to the transformed vertex position.

5. Rotate along this transformed axis.

Is this right ? Any suggestions would be appreciated.

Thanks.

DarkCoder