Panda3D
physxRevoluteJoint.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file physxRevoluteJoint.h
10  * @author enn0x
11  * @date 2009-10-02
12  */
13 
14 #ifndef PHYSXREVOLUTEJOINT_H
15 #define PHYSXREVOLUTEJOINT_H
16 
17 #include "pandabase.h"
18 
19 #include "physxJoint.h"
20 #include "physx_includes.h"
21 
23 class PhysxSpringDesc;
24 class PhysxMotorDesc;
26 
27 /**
28  * A joint which behaves in a similar way to a hinge or axel. A hinge joint
29  * removes all but a single rotational degree of freedom from two objects.
30  * The axis along which the two bodies may rotate is specified with a point
31  * and a direction vector.
32  */
33 class EXPCL_PANDAPHYSX PhysxRevoluteJoint : public PhysxJoint {
34 
35 PUBLISHED:
36  INLINE PhysxRevoluteJoint();
37  INLINE ~PhysxRevoluteJoint();
38 
39  void save_to_desc(PhysxRevoluteJointDesc &jointDesc) const;
40  void load_from_desc(const PhysxRevoluteJointDesc &jointDesc);
41 
42  void set_spring(const PhysxSpringDesc &spring);
43  void set_motor(const PhysxMotorDesc &motor);
44  void set_limits(const PhysxJointLimitDesc &low, const PhysxJointLimitDesc &high);
45  void set_flag(PhysxRevoluteJointFlag flag, bool value);
46  void set_projection_mode(PhysxProjectionMode mode);
47 
48  float get_angle() const;
49  float get_velocity() const;
50  bool get_flag(PhysxRevoluteJointFlag flag) const;
51  PhysxProjectionMode get_projection_mode() const;
52  PhysxMotorDesc get_motor() const;
53  PhysxSpringDesc get_spring() const;
54 
55 public:
56  INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; };
57 
58  void link(NxJoint *jointPtr);
59  void unlink();
60 
61 private:
62  NxRevoluteJoint *_ptr;
63 
64 public:
65  static TypeHandle get_class_type() {
66  return _type_handle;
67  }
68  static void init_type() {
69  PhysxJoint::init_type();
70  register_type(_type_handle, "PhysxRevoluteJoint",
71  PhysxJoint::get_class_type());
72  }
73  virtual TypeHandle get_type() const {
74  return get_class_type();
75  }
76  virtual TypeHandle force_init_type() {
77  init_type();
78  return get_class_type();
79  }
80 
81 private:
82  static TypeHandle _type_handle;
83 };
84 
85 #include "physxRevoluteJoint.I"
86 
87 #endif // PHYSXREVOLUTEJOINT_H
Descriptor class for distance joint.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Describes a joint motor.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
Abstract base class for the different types of joints.
Definition: physxJoint.h:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Describes a joint spring.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Describes a joint limit.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A joint which behaves in a similar way to a hinge or axel.