Panda3D
Loading...
Searching...
No Matches
physxCapsuleShape.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 physxCapsuleShape.h
10 * @author enn0x
11 * @date 2009-09-16
12 */
13
14#ifndef PHYSXCAPSULESHAPE_H
15#define PHYSXCAPSULESHAPE_H
16
17#include "pandabase.h"
18#include "luse.h"
19
20#include "physxShape.h"
21#include "physx_includes.h"
22
24
25/**
26 * A capsule shaped collision detection primitive, also known as a line swept
27 * sphere. 'radius' is the radius of the capsule's hemispherical ends and its
28 * trunk. 'height' is the distance between the two hemispherical ends of the
29 * capsule. The height is along the capsule's Y axis. Each shape is owned by
30 * an actor that it is attached to.
31 *
32 * An instance can be created by calling the createShape() method of the
33 * PhysxActor object that should own it, with a PhysxCapsuleShapeDesc object
34 * as the parameter, or by adding the shape descriptor into the PhysxActorDesc
35 * class before creating the actor.
36 *
37 * The shape is deleted by calling release() on the shape itself.
38 */
39class EXPCL_PANDAPHYSX PhysxCapsuleShape : public PhysxShape {
40
41PUBLISHED:
42 INLINE PhysxCapsuleShape();
43 INLINE ~PhysxCapsuleShape();
44
45 void save_to_desc(PhysxCapsuleShapeDesc &shapeDesc) const;
46
47 void set_radius(float radius);
48 void set_height(float height);
49
50 float get_radius() const;
51 float get_height() const;
52
53public:
54 INLINE NxShape *ptr() const { return (NxShape *)_ptr; };
55
56 void link(NxShape *shapePtr);
57 void unlink();
58
59private:
60 NxCapsuleShape *_ptr;
61
62public:
63 static TypeHandle get_class_type() {
64 return _type_handle;
65 }
66 static void init_type() {
67 PhysxShape::init_type();
68 register_type(_type_handle, "PhysxCapsuleShape",
69 PhysxShape::get_class_type());
70 }
71 virtual TypeHandle get_type() const {
72 return get_class_type();
73 }
74 virtual TypeHandle force_init_type() {
75 init_type();
76 return get_class_type();
77 }
78
79private:
80 static TypeHandle _type_handle;
81};
82
83#include "physxCapsuleShape.I"
84
85#endif // PHYSXCAPSULESHAPE_H
Descriptor class for PhysxCapsuleShape.
A capsule shaped collision detection primitive, also known as a line swept sphere.
Abstract base class for shapes.
Definition physxShape.h:39
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...