Game Development Community

Objects speed?

by Nathan · in General Discussion · 01/04/2006 (5:37 pm) · 6 replies

Hi, is there any way to tell how fast an object is moving?

#1
01/06/2006 (9:07 am)
Check, how many parrots it passes per second while movin'.
#2
01/06/2006 (9:09 am)
Just kidding ;)

A hint: I dont remember exactly, but it depends on the object class, so look at the class variables, there should be one, then expose it to the console (if it's not yet) and show it as a GUI element on your screen.
#3
01/06/2006 (9:10 am)
Nathan,

Yes. Dig into the racing mission of the Demo to see a speedometer in action and what makes it work. Yes, it's a speedometer, but whatever script stuff makes it tick might also be useful in your situation.

Aaron E.


[EDIT: thinkos]
#4
01/06/2006 (9:28 am)
%velocity = %object.getVelocity();
%speed = VectorLen(%velocity);
#5
01/06/2006 (12:43 pm)
Thanks guys! What does "VectorLen(%velocity);" do?
#6
01/06/2006 (1:13 pm)
Velocity has 3 components (x, y, and z), making it a vector which defines a speed *and* a direction. To extract a single value from this that's just a speed, you get the vector length