Game Development Community

Trouble pulling acceleration info during gameplay

by K. Anderson · in Torque Game Engine · 02/25/2008 (4:01 pm) · 2 replies

What I'm doing is filling up a datagram with different physics info and some other data, the last two things I need to fill in are the xyz acceleration and xyz angular velocities. I can live without sending the angular velocities but I need to figure out how to pass in the acceleration.

Right now I'm letting the phsyics update variables so that if there's not enough updates engine side to keep up with the network sends then at least I have the latest information from the engine. Problem is I can't find the acceleration, or what I try to pass in never works at least.

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3445
I used this resource to set up the physics gui and tried to pull out the parts I needed from that, but I couldn't figure out where the m_vVelocity was being saved that let it compare it with the current velocity pulled off the vehicle. I was thinking that I could pull the difference between the current variable value and the latest update to it but since I'm sending at a different rate than the m/s/s accel that I need it won't work.

If somebody knows a better way to get the value of the xyz acceleration on a flying vehicle could you point me to the code/resource or figure out a way to use the velocities that I have now and figure it out on a 10ms update.

TIA

#1
02/25/2008 (7:31 pm)
Differentiating signals (e.g.: velocity for an acceleration estimate) adds a LOT of noise. Often so much that the resulting value is not very useful, unless filtered. Unfortunately, filtering adds lag.

The best tick-by-tick source for the forces and torques that generate the accelerations are calculated in the updateForces method (for vehicles, at least). In WheeledVehicles, update forces calls mRigid.updateVelocity after setting the forces and torques into the mRigid object. In FlyingVehicles, this is done elsewhere (you will have to follow it through.) If you need to save additional variables for transmission, that might be the place.
#2
02/26/2008 (2:13 am)
Thanks, I was able to find what I needed with force in the updateForces method and pass it to the data being passed out. Seems like the data is good and what I needed.