# Rotate an object on another

This topic is 2500 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello,

I have a little problem, I have an object split into two (this is a helicopter) and I would like to turn the propellers of the helicopter, so I applied successive rotations each frame on propellers so that they turn on themselves. The problem is that the helicopter can move in four directions (left, right, down, up) so I applied rotations (20 °) on the helicopter and the propellers but the worry is that propellers no longer remain attached to the helicopter. How to keep "hanging" the propellers on the helicopter?

Here's a video of the problem:

##### Share on other sites
You need to apply the same transformation matrix to your propellers as you do to your helicopter.

##### Share on other sites
yes, but if I apply a rotation to rotate the propeller, the transformation matrix isn't same.

##### Share on other sites
Well, it wouldn't because the final matrix of the propeller is a product of the rotation of the propeller and the helicopter's transformation matrix.

##### Share on other sites
A child's transformation matrix is always built as its parent's matrix multiplied by the relative transformation matrix from parent to child (or from child to parent).

Parent in this case is helicopter. Its matrix consists of translation of the chopper and its yaw, pitch and roll.
Child is the blades mesh. The relative matrix between blades and chopper consist of the rotation of the blades (plus maybe translation to put the blades to a proper position on the chopper, but this may not be needed if the meshes have proper pivots).

##### Share on other sites
Just my 2 cents, but you should accomplish this effect by animating the helicopter, rather than hard coding some transforms.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 28
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634111
• Total Posts
3015563
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!