Panda3D

physxCapsuleController.h

00001 // Filename: physxCapsuleController.h
00002 // Created by:  enn0x (24Sep09)
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 PHYSXCAPSULECONTROLLER_H
00016 #define PHYSXCAPSULECONTROLLER_H
00017 
00018 #include "pandabase.h"
00019 #include "luse.h"
00020 
00021 #include "physxController.h"
00022 #include "physx_includes.h"
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : PhysxCapsuleController
00026 // Description : A capsule character controller.
00027 //
00028 //               The capsule is defined as a position, a vertical
00029 //               height, and a radius. The height is the same height
00030 //               as for PhysxCapsuleShape objects, i.e. the distance
00031 //               between the two sphere centers at the end of the
00032 //               capsule. In other words:
00033 //
00034 //               p = pos (returned by controller)
00035 //               h = height
00036 //               r = radius
00037 //
00038 //               p = center of capsule
00039 //               top sphere center = p.y + h*0.5
00040 //               bottom sphere center = p.y - h*0.5
00041 //               top capsule point = p.y + h*0.5 + r
00042 //               bottom capsule point = p.y - h*0.5 - r
00043 ////////////////////////////////////////////////////////////////////
00044 class EXPCL_PANDAPHYSX PhysxCapsuleController : public PhysxController {
00045 
00046 PUBLISHED:
00047   INLINE PhysxCapsuleController();
00048   INLINE ~PhysxCapsuleController();
00049 
00050   void set_radius(float radius);
00051   void set_height(float height);
00052   float get_radius() const;
00053   float get_height() const;
00054 
00055 ////////////////////////////////////////////////////////////////////
00056 public:
00057   INLINE NxController *ptr() const { return (NxController *)_ptr; };
00058 
00059   void link(NxController *controllerPtr);
00060   void unlink();
00061 
00062 private:
00063   NxCapsuleController *_ptr;
00064 
00065 ////////////////////////////////////////////////////////////////////
00066 public:
00067   static TypeHandle get_class_type() {
00068     return _type_handle;
00069   }
00070   static void init_type() {
00071     PhysxController::init_type();
00072     register_type(_type_handle, "PhysxCapsuleController", 
00073                   PhysxController::get_class_type());
00074   }
00075   virtual TypeHandle get_type() const {
00076     return get_class_type();
00077   }
00078   virtual TypeHandle force_init_type() {
00079     init_type();
00080     return get_class_type();
00081   }
00082 
00083 private:
00084   static TypeHandle _type_handle;
00085 };
00086 
00087 #include "physxCapsuleController.I"
00088 
00089 #endif // PHYSXCAPSULECONTROLLER_H
 All Classes Functions Variables Enumerations