Trouble rotating my models...

Blitz3D Forums/Blitz3D Beginners Area/Trouble rotating my models...

hollifd(Posted 2008) [#1]
I need to be able to load a model and then rotate it on the screen in 10 degree increments when the user presses the "R" key.

The models are actually sheet metal parts that are designed in a CAD system and then converted to 3DS files. Sometimes when I bring in the 3DS file, the models are oriented differently. When I use something like...

rotateentity part, 0,0,10
or
turnentity part, 0,0,10

the models do not rotate on the screen like I want them to. Sometimes they rotate left or right but sometimes they rotate at wierd angles because my rotate command is not applied to the correct XYZ axis.

Is there a way to always rotate a model based upon the view that is currently on the screen?

Imagine that I have a model of the letter "P" on the screen. When the user presses "R" on the keyboard, I want the model to rotate on the screen by 10 degrees. If the user presses the "R" key 9 times, then the model on the screen should look like the letter "d".

I want to have some buttons on the screen that the user can use to orient the model on the screen and then once the model is oriented correctly and flat on the screen, I want the user to be able press the "R" key and have the model rotate in 10 degree increments without turning at wierd angles. I just want it to stay flat and rotate (or turn) at 10 degree increments.

Hopefully someone will understand what my problem is and can recommend a solution.

Thanks,

David


GfK(Posted 2008) [#2]

Imagine that I have a model of the letter "P" on the screen. When the user presses "R" on the keyboard, I want the model to rotate on the screen by 10 degrees. If the user presses the "R" key 9 times, then the model on the screen should look like the letter "d".
For that, you should be using TurnEntity. The difference is that TurnEntity is relative the the objects current orientation, whereas RotateEntity is absolute.

Are you saying that you always want the object to rotate to the right (for instance) on screen, regardless of its orientation?

The easiest way of achieving that would be to create a pivot and set its Yaw to the same Yaw as the camera, position it at the same position as your model, parent the model to the pivot. Then, perform rotations on the pivot rather than on the model itself.


hollifd(Posted 2008) [#3]
Thanks GfK.

I have 3 buttons that the user can use to orient the model flat on the screen.

I think I need this because I cannot always know how the model will come into Blitz. I created 3 buttons. One will rotate the model around X by 90 degrees. The second will rotate the model around Y by 90 degrees and the last will rotate the model around Z by 90 degrees. My thought is that this will always allow the model to be reoriented correctly on the screen if it does not come into Blitz oriented correctly.

Once the user gets the model flat on the screen the way he wants, I want the model to always rotate to the right on the screen regardless of its orientation.

I have never used a pivot but I will look that up in HELP and give that a try. It sounds like that will be the solution.

Thanks again,

David


hollifd(Posted 2008) [#4]
GfK,

The pivot worked and was very easy too!

Thanks for your help,

David