Rotate around world axis.

Previous topic - Next topic

Richard Rae

How do I make a 3d object rotate around the world axis,irrespective of the objects own roll,tilt or yaw angle.Thanks

mentalthink

HI Richard you can use x_rotation phi,x,y,z

On phi, it´s a value in degress from 0 to 360, and x,y,z it´s setting put a '1' in the axis...

In example:
Make a counter whit phi and put the x_rotation phi,0,0,1, this rotate the object in Z in the viewport...
If you want have a radius from the circle... when you make the 3D mesh, change the pivot point in your 3D suite, and you have the offset...

I hope can help you...  :booze:

Richard Rae

Does X_ROTATION not just rotate the object about its own axes?

mentalthink

yes!!! :giveup: :giveup:

Try to use this:

X_rotation phi, 1+(cos(phi)*amplitude),0,1+(sin(phi)*amplitude)

I´m not sure if this will works!!! :-[

Richard Rae

I think I am not explaining myself very well.Imagine that a cube was positioned at 0,0,0 and rotated 45 deg on the x axis and 45 deg on the y axis.I want the cube to rotate say 45 deg relative to the world x axis.If I use x_rotate then the cube would rotate on its own x axis not relative to the world x axis.I want to rotate the cube on the world axes no matter the rotation of the cube on its own axes.I hope this explains things more clearly.

backslider

Maybe you should try the 3D Entity System. :)
It's very easy to handle!

http://www.glbasic.com/forum/index.php?topic=1165.0

metzzo

Code (glbasic) Select

X_MOVEMENT 0, 0, 0 //Reset position first
X_ROTATION 90, 1, 0, 0 //Rotate your world!
X_PUSHMATRIX //sets the origin to the current transformation matrix

//draw your world here

X_POPMATRIX


I think this should be what you need.
That's no Bug, that's my project!

http://programming-with-design.at/