GLBasic forum

Main forum => GLBasic - en => Topic started by: Richard Rae on 2012-May-28

Title: Rotate around world axis.
Post by: Richard Rae on 2012-May-28
How do I make a 3d object rotate around the world axis,irrespective of the objects own roll,tilt or yaw angle.Thanks
Title: Re: Rotate around world axis.
Post by: mentalthink on 2012-May-28
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:
Title: Re: Rotate around world axis.
Post by: Richard Rae on 2012-May-28
Does X_ROTATION not just rotate the object about its own axes?
Title: Re: Rotate around world axis.
Post by: mentalthink on 2012-May-28
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!!! :-[
Title: Re: Rotate around world axis.
Post by: Richard Rae on 2012-May-29
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.
Title: Re: Rotate around world axis.
Post by: backslider on 2012-May-29
Maybe you should try the 3D Entity System. :)
It's very easy to handle!

http://www.glbasic.com/forum/index.php?topic=1165.0
Title: Re: Rotate around world axis.
Post by: metzzo on 2012-May-29
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.