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 / What do the NewXValue, NewYValue, and NewZValue commands do?

Author
Message
thinkdigital
20
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 25th Mar 2005 04:51
I'd just like to ask what the NewXValue, NewYValue, and NewZValue functions are for in DBC. I've never used them before.


-thinkdigital
eGeneric Works : DB Site
Dark Flame
19
Years of Service
User Offline
Joined: 15th Feb 2005
Location: England
Posted: 25th Mar 2005 06:02 Edited at: 25th Mar 2005 06:04
I'm not completly sure...but i think a newvalue is other values in your program combined to make a new value.

From the monster hunt tut:

Quote: "
The "NewZValue" and the "NewXValue" command save you from having to use some of the higher math functions like sine and cosine. These commands calculate a new position based on another position.
"


Chris K
20
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 25th Mar 2005 07:34
They work out a new x or z value for when you are walking round in 3D.

You give it the current x value, the angle and the distance to move and it gives back the new x value.

Like this:
(from above)


Give it the black stuff and it will give you the red stuff.
It means you can move object forward the direction they are facing.

Like this:


My Showcase - It's DBpro-tastic
Soy Cocktail
20
Years of Service
User Offline
Joined: 23rd Dec 2003
Location:
Posted: 25th Mar 2005 09:47
This command is very usefull for having 2d objects move like 3d objects. I used it recently to have a ball move around in my breakout game. With 3d objects you can just point the object at the angle and then have it move foward. You can also use this command to find out where an object will be if it moves x distance at its current angle, so you can detect things early. For example you dont want your character to run into the wall so you stop the character before it reaches the wall since the x y and z points are most likely going to be at the center of the mass part of it would go through the wall if you didn't.

When life hands you lemons go buy some oranges to make orange juice, and stop expecting everything to be given to you.
thinkdigital
20
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 25th Mar 2005 10:14
Wow, thank you guys.

-thinkdigital
eGeneric Works : DB Site
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Mar 2005 01:49
perhaps the command broken down into code would show ya:

newXvalue = x + sin(angle)*distance
newZvalue = z + cos(angle)*distance


I'm not sure what the Y formula is though.

Your signature has been erased by IanM - Please get a shorter image in your sig
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 26th Mar 2005 19:05
Yeah does anyone know how to use the newyvalue commands with the newx and z commands...ive never got the results i expected.
Soy Cocktail
20
Years of Service
User Offline
Joined: 23rd Dec 2003
Location:
Posted: 27th Mar 2005 04:58
I know how to use it with just the new x. You just use it for 2d. The y angle is diffrent from the x and z angle though, so you would have to use a diffrent angle variable.

When life hands you lemons go buy some oranges to make orange juice, and stop expecting everything to be given to you.
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 28th Mar 2005 04:12
Oh for 2D ...well that makes more sence !
timthepig
19
Years of Service
User Offline
Joined: 27th Feb 2005
Location:
Posted: 29th Mar 2005 08:28
So how would you make an object move round in a full circle?
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 29th Mar 2005 11:50 Edited at: 29th Mar 2005 11:51
newx# = newxvalue(x#,angleY#,distance#)
newy# = newyvalue(y#,angleX#,distance#)
newz# = newzvalue(z#,angleY#,distance#)

I think thats how its done, I'm not sure, I haven't used them in a while.


"Lets migrate like bricks" - Me
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 29th Mar 2005 19:13 Edited at: 29th Mar 2005 21:48
Would you not have to find the distance# used in newx# and newz# if you are doing ZYX order of rotation. It would just be:

dist_h# = cos(angleX#) * distance#

and then use dist_h# (the horizontal distance moved) instead of distance in newxvalue and newzvalue.

Not sure about this command though.

Simple... yet fun!
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 29th Mar 2005 20:21
Uh, distance is just the amount of units you want to be offset from


"Lets migrate like bricks" - Me
robo cat
20
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 29th Mar 2005 21:47 Edited at: 29th Mar 2005 21:47
Then how can newxvalue take AngleX into account if the direction of movement is rotated about both the x and y axis? Thats why I think you need to use dist_h#.

Simple... yet fun!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Mar 2005 05:31
robo is right. I'd have to draw some triangles out to know exactly how the distance should be calculated.

Your signature has been erased by IanM - Please get a shorter image in your sig

Login to post a reply

Server time is: 2024-09-23 15:36:14
Your offset time is: 2024-09-23 15:36:14