Game Development Community

Dts render orientation problem

by Frank Korf · in Torque Game Engine · 07/23/2007 (4:10 pm) · 5 replies

I have a model of a ball. I am using a quaternion to store its orientation, Whenever I rotate it, it rotates the model about the bottom center of the model, and not the model's center in object space. How do I rotate the model about its center, instead of what appears to be its base point?

#1
07/23/2007 (5:11 pm)
I think you need to position the model in your modeling program so that its center is at 0,0,0 and re-export. I am unaware of any way to move the origin around after-the-fact like a pivot. (Unless maybe in some physics subsystem with a way to set center-of-mass.)
#2
07/24/2007 (8:35 am)
The center of the ball model in 3DSMax is (0,0,0).

Just to be clear, the model is rotating out of its box.

img385.imageshack.us/img385/417/ballissueni4.jpg
I just want the model to rotate about the center of the model, not the center point at the base of the model.
#3
07/24/2007 (10:18 am)
So I solved the problem with the ball moving out of its box, but I did not solve the rotation issue.

Try this: place any object (I used a RigidShape) in the world editor.
Then, try these rotations:
"1 0 0 180"
"0 1 0 180"
"0 0 1 180"

While rotating about the Z axis simply spins the model about its center, rotating about the X or Y axes spins the model about a the bottom center of the model. Also, "position" defines the bottom center, and not the model center.

Any thoughts?
#4
07/24/2007 (10:22 am)
Quote:
Frank Korf said:
So I solved the problem with the ball moving out of its box [...]

Not trying to be an ass here, but if you want people to spend their time helping you, then you might wanna share the solutions you find. That's the whole point with a forum, you know. Again, no offence - and good luck. Wish I knew what was going on.
#5
07/24/2007 (10:58 am)
I was storing the orientation separate from mObjToWorld. Then, I would use the orientation variable to update the render transform and not the standard transform. This meant that the object box did not line up with the mesh.