Hi all,
I have a problem with models rotation.
I drew a scene with nine scaled cube (just to form cards) and I positioned them in an order way onto a plane.
then I tried to apply some animation into the scene, defining a 180 degrees rotationfor each cards (standing in their own position).
At First I simply used this code:
| if (rotation[index-1] < 3.14f) |
| { |
| |
| |
| worldScena[index] = Matrix.CreateRotationY(MathHelper.ToRadians(1f))* worldScena[index]; |
| |
|
| rotation[index-1] += MathHelper.ToRadians(1f); |
| } |
where worSdscena is an array of world Matrix, one for each card.
This code works well for what reguard rotation but it adds an enlargment to cards during it (they become thicker). Cards return to the correct dimensions whene they stop to rotate.
So I tried to modify this code in this way:
| if (rotation[index-1] < 3.14f) |
| { |
| |
| worldScena.Translation=-posizioneScena[index]; |
| worldScena[index] *= Matrix.CreateRotationY(MathHelper.ToRadians(1f)); |
| wordlScena.Translation=posizioneScena[index]; |
| |
| rotation[index-1] += MathHelper.ToRadians(1f); |
| } |
where posizioneScena[] is a vector3 array which contains all of the information about initial cards position.
This code works properly, cards rotate and they don't enlarge during rotation. But this time a got another problem, after rotation "worldScena.Translation=posizioneScena[index]" doesn't carry the object where it was at the origin, but it assign it a new position.
There's something I can do to solve this last problem?
Thanks anyone could help me.