Object Velocity

Blitz3D Forums/Blitz3D Programming/Object Velocity

VIP3R(Posted 2004) [#1]
Hi folks,

What is the best method for determining an objects velocity accurately in 3D?


Rob Farley(Posted 2004) [#2]
Vipthreer, you've really got to use more words than that for decent help.

The easy way is to record the last position of an entity the after an entity has moved take the new position from the last position. Blitz has many ways to make this easier. Simply use a pivot for the last position, ie positionentity lastpos,entityx(entity),entityy(entity),entityz(entity) then after the entity has moved entitydistance(entity,lastpos) will tell you the speed, then if you pointentity lastpos,entity then you'll get the direction.


_PJ_(Posted 2004) [#3]
Velocity = delta displacement divided by time.

v=d.s/t

Speed can be worked out as above, using a delta-time variable to check the time change.

i.e.




VIP3R(Posted 2004) [#4]
I didn't think I would need to explain in more detail than that, sorry Mr Farley :)

I was doing something similar, but it wasn't accurate enough. Never thought of using EntityDistance().

Anyway, that's exactly what I needed, thanks both.


poopla(Posted 2004) [#5]
Entity distance uses pythagoras... so whatever you were doing, if not that, was simply wrong :P.


VIP3R(Posted 2004) [#6]
Careful with those revelations, I nearly ran into the street and screamed 'Eureka!' :P