Panda3D
 All Classes Functions Variables Enumerations
physxJoint.h
1 // Filename: physxJoint.h
2 // Created by: enn0x (02Oct09)
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 PHYSXJOINT_H
16 #define PHYSXJOINT_H
17 
18 #include "pandabase.h"
19 #include "pointerTo.h"
20 #include "luse.h"
21 
22 #include "physxObject.h"
23 #include "physxEnums.h"
24 #include "physx_includes.h"
25 
26 class PhysxActor;
27 class PhysxScene;
28 
29 ////////////////////////////////////////////////////////////////////
30 // Class : PhysxJoint
31 // Description : Abstract base class for the different types of
32 // joints. All joints are used to connect two dynamic
33 // actors, or an actor and the environment.
34 ////////////////////////////////////////////////////////////////////
35 class EXPCL_PANDAPHYSX PhysxJoint : public PhysxObject, public PhysxEnums {
36 
37 PUBLISHED:
38  void release();
39 
40  PhysxActor *get_actor(unsigned int idx) const;
41  PhysxScene *get_scene() const;
42 
43  void purge_limit_planes();
44 
45  void set_name(const char *name);
46  void set_global_anchor(const LPoint3f &anchor);
47  void set_global_axis(const LVector3f &axis);
48  void set_breakable(float maxForce, float maxTorque);
49  void set_solver_extrapolation_factor(float factor);
50  void set_use_acceleration_spring(bool value);
51  void set_limit_point(const LPoint3f &pos, bool isOnActor2=true);
52  void add_limit_plane(const LVector3f &normal, const LPoint3f &pointInPlane, float restitution=0.0f);
53 
54  const char *get_name() const;
55  LPoint3f get_global_anchor() const;
56  LVector3f get_global_axis() const;
57  float get_solver_extrapolation_factor() const;
58  bool get_use_acceleration_spring() const;
59 
60  INLINE void ls() const;
61  INLINE void ls(ostream &out, int indent_level=0) const;
62 
63 public:
64  static PhysxJoint *factory(NxJointType shapeType);
65 
66  virtual NxJoint *ptr() const = 0;
67 
68  virtual void link(NxJoint *shapePtr) = 0;
69  virtual void unlink() = 0;
70 
71 protected:
72  INLINE PhysxJoint();
73 
74 private:
75  string _name;
76 
77 ////////////////////////////////////////////////////////////////////
78 public:
79  static TypeHandle get_class_type() {
80  return _type_handle;
81  }
82  static void init_type() {
83  PhysxObject::init_type();
84  register_type(_type_handle, "PhysxJoint",
85  PhysxObject::get_class_type());
86  }
87  virtual TypeHandle get_type() const {
88  return get_class_type();
89  }
90  virtual TypeHandle force_init_type() {
91  init_type();
92  return get_class_type();
93  }
94 
95 private:
96  static TypeHandle _type_handle;
97 };
98 
99 #include "physxJoint.I"
100 
101 #endif // PHYSXJOINT_H
Abstract base class for the different types of joints.
Definition: physxJoint.h:35
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
A scene is a collection of bodies, constraints, and effectors which can interact. ...
Definition: physxScene.h:73
This class exists just to provide scoping for the enums shared by PhysX classes.
Definition: physxEnums.h:357
Actors are the main simulation objects.
Definition: physxActor.h:48
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85