Rotating multiple wheel (C++, DirectX and 3Ds Max)

Started by
4 comments, last by Tispe 11 years, 11 months ago
If I have 12 wheels and want to rotate them at once around themselves, how can I do that without having to select each wheel and rotate it or multi-select them?

I am looking to do that so I control all the wheels in DirectX (C++) without having to rotate each one by its name.

I want to use this:
ChangeFrameMatricesByName("wheels", &matWorld); // This line should affect all the wheels with the name (wheel1, wheel2, wheel3, etc...)

and NOT this:
ChangeFrameMatricesByName("wheel1", &matWorld);
ChangeFrameMatricesByName("wheel2", &matWorld);
ChangeFrameMatricesByName("wheel3", &matWorld);
ChangeFrameMatricesByName("wheel4", &matWorld);
ChangeFrameMatricesByName("wheel5", &matWorld);
ChangeFrameMatricesByName("wheel6", &matWorld);
// Etc...
Advertisement
Do all the wheel have the same rotation? if so, why not instead only have one wheel and draw it multiple times?
@Bayinx: I have created the whole model in 3Ds Max and loading it in DirectX using .x file, so the wheels has to be created in 3Ds Max.
All wheels need to be translated to origin before rotation or you have to do an offset rotation using D3DXMatrixTransformation for each wheel. In any case, each wheel needs to run different code as they are not at in the same position, I think.

Consolidate each wheel manipulation into a single function and call that instead?
Lets say that I have the wheels named "wheel" in 3Ds Max, is there is a way that can make me find EACH wheel that has the name "wheel"? This would be much better than making everyone has number like wheel1, wheel2, wheel3, etc...

I want to name them all the same name "wheel" and be able to rotate EVERY sub mech that has the name "wheel".

I tried D3DXFrameFind() but it only get one wheel from the 12, even when they all have the same name.
If each wheel is named "wheel" my guess is that they will all belong to the same subset, and that complicates things. Because you draw each subset with only one draw call, using the fixed function pipeline only one transformation will be applied to the whole subset. So if you can only rotate around a single point for the whole group of wheels, it will be impossible to rotate them each individually.

This topic is closed to new replies.

Advertisement