From acc662077957a500aa83c21c0cef4345bd0df679 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Wed, 16 Jul 2003 01:07:15 +0000 Subject: [PATCH] mostly debug output changes --- panda/src/physics/actorNode.cxx | 3 +- panda/src/physics/config_physics.h | 18 ++++++++ panda/src/physics/physicsCollisionHandler.cxx | 41 ++++++++----------- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/panda/src/physics/actorNode.cxx b/panda/src/physics/actorNode.cxx index 63e7842768..acf71bfe39 100644 --- a/panda/src/physics/actorNode.cxx +++ b/panda/src/physics/actorNode.cxx @@ -126,8 +126,9 @@ void ActorNode:: write(ostream &out, unsigned int indent) const { #ifndef NDEBUG //[ out.width(indent); out<<""; out<<"ActorNode:\n"; - out.width(indent+2); out<<""; out<<"_mass_center "<<_mass_center<<"\n"; out.width(indent+2); out<<""; out<<"_ok_to_callback "<<_ok_to_callback<<"\n"; + out.width(indent+2); out<<""; out<<"_mass_center\n"; + _mass_center->write(out, indent+4); PhysicalNode::write(out, indent+2); #endif //] NDEBUG } diff --git a/panda/src/physics/config_physics.h b/panda/src/physics/config_physics.h index cccc10bfd1..29ffb34602 100644 --- a/panda/src/physics/config_physics.h +++ b/panda/src/physics/config_physics.h @@ -31,9 +31,27 @@ extern EXPCL_PANDAPHYSICS void init_libphysics(); #ifndef NDEBUG //[ // Non-release build: #define PHYSICS_DEBUG + + #define physics_debug(msg) \ + if (physics_cat.is_debug()) { \ + physics_cat->debug() << msg << endl; \ + } else {} + + #define physics_info(msg) \ + physics_cat->info() << msg << endl + + #define physics_warning(msg) \ + physics_cat->warning() << msg << endl #else //][ // Release build: #undef PHYSICS_DEBUG + + #define physics_debug(msg) ((void)0) + #define physics_info(msg) ((void)0) + #define physics_warning(msg) ((void)0) #endif //] +#define audio_error(msg) \ + audio_cat->error() << msg << endl + #endif // CONFIG_PHYSICS_H diff --git a/panda/src/physics/physicsCollisionHandler.cxx b/panda/src/physics/physicsCollisionHandler.cxx index a29eb9b53d..0e5bc403ae 100755 --- a/panda/src/physics/physicsCollisionHandler.cxx +++ b/panda/src/physics/physicsCollisionHandler.cxx @@ -61,49 +61,42 @@ apply_linear_force(ColliderDef &def, const LVector3f &force) { 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 "< "<<(initialVelMag>temp) - <almostStationary) { - friction*=0.01f; cerr<<"not almostStationary"<almostStationary) { + physics_debug(" vel > almostStationary"); + friction*=0.01f; } //vel*=1.0f-friction; } - LVector3f new_vel=vel; + #ifndef NDEBUG //[ if (vel.length() > old_vel.length()) { - cerr<<"\nvel.length() > old_vel.length() "< "< old_vel.length() "< "< 10.0f) { - cerr<<"\nvel.length() > 10.0f "< 10.0f "<set_contact_vector(force); actor->get_physics_object()->set_velocity(vel); }