Panda3D
 All Classes Functions Variables Enumerations
physicsCollisionHandler.h
1 // Filename: physicsCollisionHandler.h
2 // Created by: drose (16Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef PHYSICSCOLLISIONHANDLER_H
16 #define PHYSICSCOLLISIONHANDLER_H
17 
18 #include "pandabase.h"
19 
20 #include "collisionHandlerPusher.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : PhysicsCollisionHandler
24 // Description : A specialized kind of CollisionHandler that simply
25 // pushes back on things that attempt to move into solid
26 // walls. This also puts forces onto the physics objects
27 ////////////////////////////////////////////////////////////////////
28 class EXPCL_PANDAPHYSICS PhysicsCollisionHandler :
29  public CollisionHandlerPusher {
30 PUBLISHED:
32  virtual ~PhysicsCollisionHandler();
33 
34  // These setters and getter are a bit of a hack:
35  INLINE void set_almost_stationary_speed(PN_stdfloat speed);
36  INLINE PN_stdfloat get_almost_stationary_speed();
37 
38  INLINE void set_static_friction_coef(PN_stdfloat coef);
39  INLINE PN_stdfloat get_static_friction_coef();
40 
41  INLINE void set_dynamic_friction_coef(PN_stdfloat coef);
42  INLINE PN_stdfloat get_dynamic_friction_coef();
43 
44 protected:
45  PN_stdfloat _almost_stationary_speed;
46  PN_stdfloat _static_friction_coef;
47  PN_stdfloat _dynamic_friction_coef;
48 
49  void apply_friction(
50  ColliderDef &def, LVector3 &vel, const LVector3& force, PN_stdfloat angle);
51  virtual void apply_net_shove(
52  ColliderDef &def, const LVector3 &net_shove,
53  const LVector3 &force_normal);
54  virtual void apply_linear_force(ColliderDef &def, const LVector3 &force);
55 
56  virtual bool validate_target(const NodePath &target);
57 
58 public:
59  static TypeHandle get_class_type() {
60  return _type_handle;
61  }
62  static void init_type() {
63  CollisionHandlerPusher::init_type();
64  register_type(_type_handle, "PhysicsCollisionHandler",
65  CollisionHandlerPusher::get_class_type());
66  }
67  virtual TypeHandle get_type() const {
68  return get_class_type();
69  }
70  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
71 
72 private:
73  static TypeHandle _type_handle;
74 };
75 
76 #include "physicsCollisionHandler.I"
77 
78 #endif
79 
80 
81 
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
A specialized kind of CollisionHandler that simply pushes back on things that attempt to move into so...
A specialized kind of CollisionHandler that simply pushes back on things that attempt to move into so...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165