Panda3D
physxCapsuleShape.h
1 // Filename: physxCapsuleShape.h
2 // Created by: enn0x (16Sep09)
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 PHYSXCAPSULESHAPE_H
16 #define PHYSXCAPSULESHAPE_H
17 
18 #include "pandabase.h"
19 #include "luse.h"
20 
21 #include "physxShape.h"
22 #include "physx_includes.h"
23 
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : PhysxCapsuleShape
28 // Description : A capsule shaped collision detection primitive,
29 // also known as a line swept sphere. 'radius' is the
30 // radius of the capsule's hemispherical ends and its
31 // trunk. 'height' is the distance between the two
32 // hemispherical ends of the capsule. The height is
33 // along the capsule's Y axis. Each shape is owned by
34 // an actor that it is attached to.
35 //
36 // An instance can be created by calling the
37 // createShape() method of the PhysxActor object that
38 // should own it, with a PhysxCapsuleShapeDesc object
39 // as the parameter, or by adding the shape descriptor
40 // into the PhysxActorDesc class before creating the
41 // actor.
42 //
43 // The shape is deleted by calling release() on the
44 // shape itself.
45 ////////////////////////////////////////////////////////////////////
46 class EXPCL_PANDAPHYSX PhysxCapsuleShape : public PhysxShape {
47 
48 PUBLISHED:
49  INLINE PhysxCapsuleShape();
50  INLINE ~PhysxCapsuleShape();
51 
52  void save_to_desc(PhysxCapsuleShapeDesc &shapeDesc) const;
53 
54  void set_radius(float radius);
55  void set_height(float height);
56 
57  float get_radius() const;
58  float get_height() const;
59 
60 ////////////////////////////////////////////////////////////////////
61 public:
62  INLINE NxShape *ptr() const { return (NxShape *)_ptr; };
63 
64  void link(NxShape *shapePtr);
65  void unlink();
66 
67 private:
68  NxCapsuleShape *_ptr;
69 
70 ////////////////////////////////////////////////////////////////////
71 public:
72  static TypeHandle get_class_type() {
73  return _type_handle;
74  }
75  static void init_type() {
76  PhysxShape::init_type();
77  register_type(_type_handle, "PhysxCapsuleShape",
78  PhysxShape::get_class_type());
79  }
80  virtual TypeHandle get_type() const {
81  return get_class_type();
82  }
83  virtual TypeHandle force_init_type() {
84  init_type();
85  return get_class_type();
86  }
87 
88 private:
89  static TypeHandle _type_handle;
90 };
91 
92 #include "physxCapsuleShape.I"
93 
94 #endif // PHYSXCAPSULESHAPE_H
Abstract base class for shapes.
Definition: physxShape.h:41
Descriptor class for PhysxCapsuleShape.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
A capsule shaped collision detection primitive, also known as a line swept sphere.