Lupin1985

09-28-2015, 01:48 PM

Hi to all !

I'm beginner in Opengl and i need help. I'll try to explain my problem:

I've loaded 5 3d object models (.obj) and now I need to move them like a "chain".

I'll try to explain better: the first one has a position and an orientation. It can rotate along its Z axis.

The second one also has an own position and orientation but them depends from the position and the orientation of the first one.

All the next models have their own position and orientation depending from the previous one.

To obtain this I do this for each model: (short pseudocode)

- load model (vertex)

- translate it to (0,0,0)

- rotate around its axis

- translate it to original position

- send to shader the resulting matrix

- draw(1)

The next model:

- load model

- translate it to (0,0,0)

- rotate around the axe of the previous model

- rotate around its axis

- translate it to its original position

- send to shader the resulting matrix

- draw(2)

..and so on.

The problem is that when accumulate rotations/translations the models don't go where should go especially when accumulate different axis rotations.

I don't know if I do a math mistake or an opengl error.

I hope be sufficently clear and I hope somebody can help me. Thanks in advance !

I'm beginner in Opengl and i need help. I'll try to explain my problem:

I've loaded 5 3d object models (.obj) and now I need to move them like a "chain".

I'll try to explain better: the first one has a position and an orientation. It can rotate along its Z axis.

The second one also has an own position and orientation but them depends from the position and the orientation of the first one.

All the next models have their own position and orientation depending from the previous one.

To obtain this I do this for each model: (short pseudocode)

- load model (vertex)

- translate it to (0,0,0)

- rotate around its axis

- translate it to original position

- send to shader the resulting matrix

- draw(1)

The next model:

- load model

- translate it to (0,0,0)

- rotate around the axe of the previous model

- rotate around its axis

- translate it to its original position

- send to shader the resulting matrix

- draw(2)

..and so on.

The problem is that when accumulate rotations/translations the models don't go where should go especially when accumulate different axis rotations.

I don't know if I do a math mistake or an opengl error.

I hope be sufficently clear and I hope somebody can help me. Thanks in advance !