collision (response) what with velocity when it hits the ground.

Started by
0 comments, last by _WeirdCat_ 9 years, 3 months ago

first to make everything clear i move an object like this:




result_force = Gravitational_force + ThrustForce + friction + LEGS; //some forces that are acting on player
Acceleration = result_force / mass;

pos = pos + (vel * time_between_frames);
vel = vel + (Acceleration * time_between_frames);

all of them are vectors.

The thing is i am dropping a player from 20m above the surface, then when i hit i must somehow to (filter pulsejumps but thats not the issue for now) stop it from moving towards earth i mean collision works but i must zero the velocity vector after collision, but when i do such thing every frame i won't be able to move my player in any direction (because when near surface it will always catch collision and vel vector will be zeroed)

is there any good way to zero the velocity (i think i could make a bool that says if collision acts and its set to true with frist collision then if its false (when collision occured) i zero the vel vector, and that bool will be set to false whenever thers no collision, but it looks like a nasty approach.

for now when i get collision i set LEGS force to be -Q force so the gravitation doesnt act but it will zero velocity over time (read: too long i needs to rapidly loose vel to 0 ;])

anyway when dealing with only velocity and applying a formula below it produces pulse jumps then..


double trnd = Dot(p->vehicle->vel, collision_face_normal);
p->vehicle->vel = p->vehicle->vel - collision_face_normal*trnd;

Advertisement

its solved problem was floating point accuracy.

a little vid

This topic is closed to new replies.

Advertisement