Panda3D
physxRevoluteJoint.h
1 // Filename: physxRevoluteJoint.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 PHYSXREVOLUTEJOINT_H
16 #define PHYSXREVOLUTEJOINT_H
17 
18 #include "pandabase.h"
19 
20 #include "physxJoint.h"
21 #include "physx_includes.h"
22 
24 class PhysxSpringDesc;
25 class PhysxMotorDesc;
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : PhysxRevoluteJoint
30 // Description : A joint which behaves in a similar way to a hinge
31 // or axel. A hinge joint removes all but a single
32 // rotational degree of freedom from two objects. The
33 // axis along which the two bodies may rotate is
34 // specified with a point and a direction vector.
35 ////////////////////////////////////////////////////////////////////
36 class EXPCL_PANDAPHYSX PhysxRevoluteJoint : public PhysxJoint {
37 
38 PUBLISHED:
39  INLINE PhysxRevoluteJoint();
40  INLINE ~PhysxRevoluteJoint();
41 
42  void save_to_desc(PhysxRevoluteJointDesc &jointDesc) const;
43  void load_from_desc(const PhysxRevoluteJointDesc &jointDesc);
44 
45  void set_spring(const PhysxSpringDesc &spring);
46  void set_motor(const PhysxMotorDesc &motor);
47  void set_limits(const PhysxJointLimitDesc &low, const PhysxJointLimitDesc &high);
48  void set_flag(PhysxRevoluteJointFlag flag, bool value);
49  void set_projection_mode(PhysxProjectionMode mode);
50 
51  float get_angle() const;
52  float get_velocity() const;
53  bool get_flag(PhysxRevoluteJointFlag flag) const;
54  PhysxProjectionMode get_projection_mode() const;
55  PhysxMotorDesc get_motor() const;
56  PhysxSpringDesc get_spring() const;
57 
58 ////////////////////////////////////////////////////////////////////
59 public:
60  INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; };
61 
62  void link(NxJoint *jointPtr);
63  void unlink();
64 
65 private:
66  NxRevoluteJoint *_ptr;
67 
68 ////////////////////////////////////////////////////////////////////
69 public:
70  static TypeHandle get_class_type() {
71  return _type_handle;
72  }
73  static void init_type() {
74  PhysxJoint::init_type();
75  register_type(_type_handle, "PhysxRevoluteJoint",
76  PhysxJoint::get_class_type());
77  }
78  virtual TypeHandle get_type() const {
79  return get_class_type();
80  }
81  virtual TypeHandle force_init_type() {
82  init_type();
83  return get_class_type();
84  }
85 
86 private:
87  static TypeHandle _type_handle;
88 };
89 
90 #include "physxRevoluteJoint.I"
91 
92 #endif // PHYSXREVOLUTEJOINT_H
Descriptor class for distance joint.
Describes a joint motor.
Abstract base class for the different types of joints.
Definition: physxJoint.h:35
Describes a joint spring.
Describes a joint limit.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
A joint which behaves in a similar way to a hinge or axel.