Panda3D

physxCapsuleShape.h

00001 // Filename: physxCapsuleShape.h
00002 // Created by:  enn0x (16Sep09)
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 PHYSXCAPSULESHAPE_H
00016 #define PHYSXCAPSULESHAPE_H
00017 
00018 #include "pandabase.h"
00019 #include "luse.h"
00020 
00021 #include "physxShape.h"
00022 #include "physx_includes.h"
00023 
00024 class PhysxCapsuleShapeDesc;
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : PhysxCapsuleShape
00028 // Description : A capsule shaped collision detection primitive,
00029 //               also known as a line swept sphere. 'radius' is the
00030 //               radius of the capsule's hemispherical ends and its
00031 //               trunk. 'height' is the distance between the two
00032 //               hemispherical ends of the capsule. The height is
00033 //               along the capsule's Y axis. Each shape is owned by
00034 //               an actor that it is attached to.
00035 //
00036 //               An instance can be created by calling the
00037 //               createShape() method of the PhysxActor object that
00038 //               should own it, with a PhysxCapsuleShapeDesc object
00039 //               as the parameter, or by adding the shape descriptor
00040 //               into the PhysxActorDesc class before creating the
00041 //               actor.
00042 //
00043 //               The shape is deleted by calling release() on the
00044 //               shape itself.
00045 ////////////////////////////////////////////////////////////////////
00046 class EXPCL_PANDAPHYSX PhysxCapsuleShape : public PhysxShape {
00047 
00048 PUBLISHED:
00049   INLINE PhysxCapsuleShape();
00050   INLINE ~PhysxCapsuleShape();
00051 
00052   void save_to_desc(PhysxCapsuleShapeDesc &shapeDesc) const;
00053 
00054   void set_radius(float radius);
00055   void set_height(float height);
00056 
00057   float get_radius() const;
00058   float get_height() const;
00059 
00060 ////////////////////////////////////////////////////////////////////
00061 public:
00062   INLINE NxShape *ptr() const { return (NxShape *)_ptr; };
00063 
00064   void link(NxShape *shapePtr);
00065   void unlink();
00066 
00067 private:
00068   NxCapsuleShape *_ptr;
00069 
00070 ////////////////////////////////////////////////////////////////////
00071 public:
00072   static TypeHandle get_class_type() {
00073     return _type_handle;
00074   }
00075   static void init_type() {
00076     PhysxShape::init_type();
00077     register_type(_type_handle, "PhysxCapsuleShape", 
00078                   PhysxShape::get_class_type());
00079   }
00080   virtual TypeHandle get_type() const {
00081     return get_class_type();
00082   }
00083   virtual TypeHandle force_init_type() {
00084     init_type();
00085     return get_class_type();
00086   }
00087 
00088 private:
00089   static TypeHandle _type_handle;
00090 };
00091 
00092 #include "physxCapsuleShape.I"
00093 
00094 #endif // PHYSXCAPSULESHAPE_H
 All Classes Functions Variables Enumerations