From e88c6726d7bf3f5bc0b46880734e9182a2c63676 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Fri, 25 Jul 2003 22:06:40 +0000 Subject: [PATCH] changed force coordinate frame --- panda/src/physics/physicsCollisionHandler.cxx | 59 +++++++++++++------ 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/panda/src/physics/physicsCollisionHandler.cxx b/panda/src/physics/physicsCollisionHandler.cxx index 0e5bc403ae..75561aa7fc 100755 --- a/panda/src/physics/physicsCollisionHandler.cxx +++ b/panda/src/physics/physicsCollisionHandler.cxx @@ -59,37 +59,60 @@ apply_linear_force(ColliderDef &def, const LVector3f &force) { return; } ActorNode *actor=DCAST(ActorNode, def._node); - float friction=0.9f; LVector3f vel=actor->get_physics_object()->get_velocity(); physics_debug("apply_linear_force() {"); physics_debug(" vel "<get_physics_object()->get_lcs(); + physics_debug(" adjustment set "<almostStationary) { - physics_debug(" vel > almostStationary"); - friction*=0.01f; + physics_debug(" adjustment nrm "<0.0f) { + physics_debug(" positive contact"); + adjustment*=adjustmentLength; + physics_debug(" adjustment mul "<get_physics_object()->get_implicit_velocity(); + physics_debug(" implicitVel "< old_vel.length()) { + // This is a check to avoid adding engergy: physics_debug(" vel.length() > old_vel.length() "< "< 10.0f) { + // This is a check to see if the velocity is higher than I expect it + // to go. The check value is arbitrary. physics_debug(" vel.length() > 10.0f "<set_contact_vector(force); + actor->set_contact_vector(adjustment); actor->get_physics_object()->set_velocity(vel); }