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.

DarkBASIC Discussion / evil axis

Author
Message
Alduce
21
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 22nd Nov 2002 01:31
Hi to all PLEASE modify this code that show the bad axis problem!!!
Your objective is to make all 3 axis correctly functionally!
PLEASE HELP ME BECAUSE I IN SURRENDER MODE...



make object cube 1, 110
scale object 1,20,5,50
yrotate object 1,270
xrotate object 1,0
zrotate object 1,0
fix object pivot 1

rem Activate manual sync
sync on

rem Begin main loop
while mouseclick()=0

set cursor 0,0
print "X = "; object angle x(1)
print "Y = "; object angle y(1)
print "Z = "; object angle z(1)
rem Control variables with the cursor keys
if inkey$()="a" then dx#=newxvalue(dx#, angle#, 3.0) : dz#=newzvalue(dz#, angle#, 3.0)
if inkey$()="z" then dx#=newxvalue(dx#, angle#, -3.0) : dz#=newzvalue(dz#, angle#, -3.0)

if leftkey()=1 then anglek#=wrapvalue(anglek#+10)
if rightkey()=1 then anglek#=wrapvalue(anglek#-10)

if upkey()=1 then angleq#=wrapvalue(angleq#+10)
if downkey()=1 then angleq#=wrapvalue(angleq#-10)

if inkey$()="," then angle#=wrapvalue(angle#-10)
if inkey$()="." then angle#=wrapvalue(angle#+10)

rem Update the object with these new values
position object 1,x#,0,z#
yrotate object 1,angle#
zrotate object 1,anglek#
xrotate object 1,angleq#
rem Update Screen
sync

rem End main loop
endwhile

rem End the program
end



PLEASE HELP ME!
Luke
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: United States
Posted: 23rd Nov 2002 16:37
[without looking at the program that much]
They do work correctly.
DB rotate an object on the x axis, then y, then z, so the x rotate will always be the world axis. And the z rotate will always be ob the objects axises. I'm guessing that you want the y to rotate first right? Well, you can't. The usual way I do that is to have one invisible object be only rotated on the y axis, then have a second object be the real object, that rotates on the x and z axises, then glue them together. if you want the rotation to be rotated ob the z then y then x then it is easier, so call this: "SET OBJECT ROTATION ZYX object number." Ya, I wish there was a set object rotation yxz But there isn't.
So because DB rotates the x, then y, then z axises, when the object is rotated 0,90,0, then some x or z rotation amount, then it will seem that x and z will rotate on the same axis! So the way to make the y always be the world-y axis, and x/z always be the x/z axises relative to the object, then, have one invisible object be the world-y axis, that only rotates along the y, then have the 'real' object be a second object glued to the first. Then.. wait I'm repeating myself! LOL

www.CyberLuke.com

Login to post a reply

Server time is: 2024-03-01 04:07:31
Your offset time is: 2024-03-01 04:07:31