Panda3D
 All Classes Functions Variables Enumerations
physxRevoluteJoint.h
00001 // Filename: physxRevoluteJoint.h
00002 // Created by:  enn0x (02Oct09)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef PHYSXREVOLUTEJOINT_H
00016 #define PHYSXREVOLUTEJOINT_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "physxJoint.h"
00021 #include "physx_includes.h"
00022 
00023 class PhysxRevoluteJointDesc;
00024 class PhysxSpringDesc;
00025 class PhysxMotorDesc;
00026 class PhysxJointLimitDesc;
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //       Class : PhysxRevoluteJoint
00030 // Description : A joint which behaves in a similar way to a hinge
00031 //               or axel. A hinge joint removes all but a single
00032 //               rotational degree of freedom from two objects. The
00033 //               axis along which the two bodies may rotate is
00034 //               specified with a point and a direction vector.
00035 ////////////////////////////////////////////////////////////////////
00036 class EXPCL_PANDAPHYSX PhysxRevoluteJoint : public PhysxJoint {
00037 
00038 PUBLISHED:
00039   INLINE PhysxRevoluteJoint();
00040   INLINE ~PhysxRevoluteJoint();
00041 
00042   void save_to_desc(PhysxRevoluteJointDesc &jointDesc) const;
00043   void load_from_desc(const PhysxRevoluteJointDesc &jointDesc);
00044 
00045   void set_spring(const PhysxSpringDesc &spring);
00046   void set_motor(const PhysxMotorDesc &motor);
00047   void set_limits(const PhysxJointLimitDesc &low, const PhysxJointLimitDesc &high);
00048   void set_flag(PhysxRevoluteJointFlag flag, bool value);
00049   void set_projection_mode(PhysxProjectionMode mode);
00050 
00051   float get_angle() const;
00052   float get_velocity() const;
00053   bool get_flag(PhysxRevoluteJointFlag flag) const;
00054   PhysxProjectionMode get_projection_mode() const;
00055   PhysxMotorDesc get_motor() const;
00056   PhysxSpringDesc get_spring() const;
00057 
00058 ////////////////////////////////////////////////////////////////////
00059 public:
00060   INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; };
00061 
00062   void link(NxJoint *jointPtr);
00063   void unlink();
00064 
00065 private:
00066   NxRevoluteJoint *_ptr;
00067 
00068 ////////////////////////////////////////////////////////////////////
00069 public:
00070   static TypeHandle get_class_type() {
00071     return _type_handle;
00072   }
00073   static void init_type() {
00074     PhysxJoint::init_type();
00075     register_type(_type_handle, "PhysxRevoluteJoint", 
00076                   PhysxJoint::get_class_type());
00077   }
00078   virtual TypeHandle get_type() const {
00079     return get_class_type();
00080   }
00081   virtual TypeHandle force_init_type() {
00082     init_type();
00083     return get_class_type();
00084   }
00085 
00086 private:
00087   static TypeHandle _type_handle;
00088 };
00089 
00090 #include "physxRevoluteJoint.I"
00091 
00092 #endif // PHYSXREVOLUTEJOINT_H
 All Classes Functions Variables Enumerations