Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / xrotate object vs turn object

Author
Message
Sushi01
16
Years of Service
User Offline
Joined: 14th Nov 2008
Location: Houston, Texas
Posted: 19th Nov 2008 06:52
Hi, Im new and I have a question

how come this code will not rotate my object continuously in the loop?

MAKE OBJECT SPHERE 1, 20

DO
xrotate object 1, 1.0
LOOP

WAIT KEY
END

but when i exchange the loop with this code,

DO
TURN OBJECT RIGHT 1, 1.0
LOOP

it rotates continuously. why is that?


www.ktt3d.com
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 19th Nov 2008 11:48
Because XROTATE OBJECT will set the exact x angle of the object, whilst TURN OBJECT will add to the current angle of the object.
Also, if you want to achieve the same result as with turn object, you would have to use YROTATE OBJECT instead

To do it with the rotation commands you can use the OBJECT ANGLE X, Y and Z commands like so:

WRAPVALUE will constrain the value to the range 0..360 and is thus needed when handling angles; assume that your equation will give the resul 362 - wrapvalue will then wrap it around to 2 and you're good to go.


-> Oh, come on...
Sushi01
16
Years of Service
User Offline
Joined: 14th Nov 2008
Location: Houston, Texas
Posted: 19th Nov 2008 20:05
Ah thnx Rudolpho,

but whats the difference between XROTATE OBJECT and the expression OBJECT ANGLE X. I thought OBJECT ANGLE X set the exact X angle of the object. Is that true only if you have a variable equal to it, rather than an actual value?

So basically, are expressions meant to return the value of variables?
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 24th Nov 2008 05:51
XROTATE OBJECT sets the object's X angle, OBJECT ANGLE X gives you the object's current X angle.

Expressions are commands that return a value, you've got it.

Login to post a reply

Server time is: 2024-11-15 23:11:30
Your offset time is: 2024-11-15 23:11:30