Physics based character movment
Does anyone have a sample algorithm or tutorial for how much force to apply to a physics body in one axis to make it move given a desired velocity along said axis and a maximum force to apply to achieve said velocity.
Its for a 2d platformer and I set all the friction to zero so the characters will behave the same in mid air or on the ground.
float desiredVelocity, currentVelocity;
const float timeStep = 0.1f;
float deltaV = desiredVelocity - currentVelocity;
float impulse = deltaV * mass;
float force = impulse / timeStep;
const float timeStep = 0.1f;
float deltaV = desiredVelocity - currentVelocity;
float impulse = deltaV * mass;
float force = impulse / timeStep;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement