getVelocity? (or equiv)

Hi, this is probably a stupid question, but im using the panda physics engine to run a simple vehicle, and i’d like to know the speed of my vehicle, its a hover tank, so im trying to keep it hoving at around the same level, at the moment ive got a dumb system that just fires the engines with a force linearly related to how close to the ground the tank is, this works okish, but the tank will bounce up and down forever, since theres no air resistance.

but even with air resistance, it would still bounce longer than it should. I’ve reached the conclusion that I need the current velocity of the tank, that way i can choose how strong a force the engines give so that it ends up in the right position with no velocity. I know velocity must be in your code somewhere since you need velocity when simulating forces, but how do i get it? surely theres a way?

if i can set it too, i would be very happy.

a related question, is there a built in way to simulate air resistance, that would alleviate some of the issues I’m seeing now… (if not, im going to need speed to calculate the air resistance myself)

EDIT: btw, it seems really strange that velocity isn’t obviously shown, i can easily get and set displacement, acceleration and even a force that takes mass into account to create an acceleration, those options leave a blatant, glaring hole where velocity is…

Have you seen PhysicsObject.getVelocity()? And LinearFrictionForce?


…no i had not, I did, however, warn that it might be a stupid question :smiley:

thank you very much, i feel pretty stupid now.

ill try it out asap.