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 / newx/y/zvalue question

Author
Message
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 28th Jul 2006 05:51
I am a little confused with the syntax of the newxvalue(and y and z) command. It says that it requires and angle, but what angle do you use? Do you use the objects x angle for the newxvalue command, the y angle for the newyvalue, and the z angle for the newzvalue or is it another order of them?

Thanks for your help
Profit
19
Years of Service
User Offline
Joined: 19th Feb 2006
Location: United States
Posted: 28th Jul 2006 06:01 Edited at: 28th Jul 2006 17:21
Imagine you wanted to Move Object 1,5 (I think Move Object moves the object forward in the direction it's pointing). Now imagine you just wanted to figure out where it would end up if you moved it forward (But not actually move it). This can be done using these commands. Now try to imagine that you wanted to use these commands and I will tell you how. I believe it'd go something like this:

(This might not be right because I haven't used DB in a few months. If it's wrong, sorry, and maybe an elder can help you out here.)

common people are walking in line.
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 28th Jul 2006 17:09 Edited at: 28th Jul 2006 17:10
They're just like the Sin/Tan/Cos commands but longer and more pointless.

If you wanted to move an object forward, you could do this:



Basically, newxvalue finds the x coordinate at any angle a certain distance.

Another way to do it is this:
newxvalue(x,a,d) = x+sin(a)*d
newyvalue(y,a,d) = y+tan(a)*d
newzvalue(z,a,d) = z+cos(a)*d

Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Jul 2006 04:53
actually, i think newXvalue uses cos and Z uses sin

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 2nd Aug 2006 09:43
so you always use y for the angle? what if the object is a plane and starts flying down?
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 2nd Aug 2006 15:34
Well you only need the Y angle if you're not moving up or down. I don't know how to use the new*value commands to make an object move forward no matter what the x angle, but with the sin and cos commands it's as simple as pi:




@Phaelax

You sure? I never knew that :S

BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 2nd Aug 2006 20:49
thanks! one wierd thing about that code, though is that it is slightly off. not much to make a difference (something like .00013) was the difference one time. So like I said, it is no big deal.

Glad it works and thanks again!

Login to post a reply

Server time is: 2025-05-25 06:33:31
Your offset time is: 2025-05-25 06:33:31