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 Professional Discussion / NewZvalue equation?

Author
Message
2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 25th Jul 2012 17:57 Edited at: 25th Jul 2012 18:02
Does anyone know the equation for newzvalue?

Quote: "It's often used when moving something, like a sprite - you'd pass the current sprite coordinates, angle, and distance to move.

Newxvalue(100.0,45.0,1.0)
Newyvalue(100.0,45.0,1.0)

is the same as:

100.0+(sin(45.0)*1.0)
100.0+(cos(45.0)*1.0)"



Cheers.

God help me, Please.
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 25th Jul 2012 19:01 Edited at: 25th Jul 2012 19:08
You'd probably want something like these for accurate 3D movement as this will take into account the x angle as well.



[Edit] Fixed some stupid mistakes. Spend too much time switching between programming languages! [/Edit]


Previously TEH_CODERER.
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 25th Jul 2012 20:46 Edited at: 25th Jul 2012 20:48
Extracted from the dbpro source and converted to dbpro:



[b]
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 25th Jul 2012 22:26 Edited at: 26th Jul 2012 16:59
2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 29th Jul 2012 16:54
@Diggsey
Thanks, the only thing is the some of the equations I was told earlier seem to be different from that, but I'll just try them all and post here if I find a problem.


Cheers.

God help me, Please.
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 31st Jul 2012 19:04
only remember that when programming 2D you need to use:

newxvalue
newzvalue instead of newyvalue

Login to post a reply

Server time is: 2026-07-08 12:26:34
Your offset time is: 2026-07-08 12:26:34