Panda3D
|
A specialized kind of CollisionHandler that simply pushes back on things that attempt to move into solid walls. More...
#include "physicsCollisionHandler.h"
Public Member Functions | |
virtual TypeHandle | force_init_type () |
PN_stdfloat | get_almost_stationary_speed () |
PN_stdfloat | get_dynamic_friction_coef () |
PN_stdfloat | get_static_friction_coef () |
virtual TypeHandle | get_type () const |
void | set_almost_stationary_speed (PN_stdfloat speed) |
void | set_dynamic_friction_coef (PN_stdfloat coef) |
void | set_static_friction_coef (PN_stdfloat coef) |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. | |
Protected Member Functions | |
void | apply_friction (ColliderDef &def, LVector3 &vel, const LVector3 &force, PN_stdfloat angle) |
The vel parameter will be modified in place to account for friction. | |
virtual void | apply_linear_force (ColliderDef &def, const LVector3 &force) |
This is an optional hook for derived classes to do some work with the ColliderDef and the force vector. | |
virtual void | apply_net_shove (ColliderDef &def, const LVector3 &net_shove, const LVector3 &force_normal) |
This is an optional hook for derived classes to do some work with the ColliderDef and the force vector. | |
virtual bool | validate_target (const NodePath &target) |
Called internally to validate the target passed to add_collider(). | |
Protected Attributes | |
PN_stdfloat | _almost_stationary_speed |
PN_stdfloat | _dynamic_friction_coef |
PN_stdfloat | _static_friction_coef |
A specialized kind of CollisionHandler that simply pushes back on things that attempt to move into solid walls.
This also puts forces onto the physics objects
Definition at line 28 of file physicsCollisionHandler.h.
void PhysicsCollisionHandler::apply_friction | ( | ColliderDef & | def, |
LVector3 & | vel, | ||
const LVector3 & | force, | ||
PN_stdfloat | angle | ||
) | [protected] |
The vel parameter will be modified in place to account for friction.
Definition at line 55 of file physicsCollisionHandler.cxx.
References ClockObject::get_dt(), ClockObject::get_global_clock(), LVecBase3f::length(), and LVector3f::zero().
Referenced by apply_net_shove().
void PhysicsCollisionHandler::apply_linear_force | ( | ColliderDef & | def, |
const LVector3 & | force | ||
) | [protected, virtual] |
This is an optional hook for derived classes to do some work with the ColliderDef and the force vector.
Reimplemented from CollisionHandlerPusher.
Definition at line 197 of file physicsCollisionHandler.cxx.
void PhysicsCollisionHandler::apply_net_shove | ( | ColliderDef & | def, |
const LVector3 & | net_shove, | ||
const LVector3 & | force_normal | ||
) | [protected, virtual] |
This is an optional hook for derived classes to do some work with the ColliderDef and the force vector.
Reimplemented from CollisionHandlerPusher.
Definition at line 91 of file physicsCollisionHandler.cxx.
References PhysicsObject::add_impact(), apply_friction(), PhysicsObject::get_lcs(), PhysicsObject::get_velocity(), NodePath::is_empty(), LVecBase3f::length(), NodePath::node(), PhysicsObject::set_velocity(), and LVector3f::zero().
static void PhysicsCollisionHandler::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from CollisionHandlerPusher.
Definition at line 62 of file physicsCollisionHandler.h.
References CollisionHandlerPusher::init_type().
bool PhysicsCollisionHandler::validate_target | ( | const NodePath & | target | ) | [protected, virtual] |
Called internally to validate the target passed to add_collider().
Returns true if acceptable, false otherwise.
Reimplemented from CollisionHandlerPhysical.
Definition at line 208 of file physicsCollisionHandler.cxx.
References TypedObject::is_of_type(), NodePath::node(), and CollisionHandlerPhysical::validate_target().