Panda3D

Loading...
Searching...
No Matches
physxCapsuleShape.cxx
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.cxx
10 * @author enn0x
11 * @date 2009-09-16
12 */
13
14#include "physxCapsuleShape.h"
15#include "physxCapsuleShapeDesc.h"
16
17 TypeHandle PhysxCapsuleShape::_type_handle;
18
19/**
20 *
21 */
22 void PhysxCapsuleShape::
23link(NxShape *shapePtr) {
24
25 _ptr = shapePtr->isCapsule();
26 _ptr->userData = this;
27 _error_type = ET_ok;
28
29 set_name(shapePtr->getName());
30
31 PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
32 actor->_shapes.add(this);
33}
34
35/**
36 *
37 */
38 void PhysxCapsuleShape::
39unlink() {
40
41 _ptr->userData = nullptr;
42 _error_type = ET_released;
43
44 PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
45 actor->_shapes.remove(this);
46}
47
48/**
49 * Saves the state of the shape object to a descriptor.
50 */
51 void PhysxCapsuleShape::
52 save_to_desc(PhysxCapsuleShapeDesc &shapeDesc) const {
53
54 nassertv(_error_type == ET_ok);
55 _ptr->saveToDesc(shapeDesc._desc);
56}
57
58/**
59 * Alters the radius of the capsule.
60 */
61 void PhysxCapsuleShape::
62 set_radius(float radius) {
63
64 nassertv(_error_type == ET_ok);
65 _ptr->setRadius(radius);
66}
67
68/**
69 * Alters the height of the capsule.
70 */
71 void PhysxCapsuleShape::
72 set_height(float height) {
73
74 nassertv(_error_type == ET_ok);
75 _ptr->setHeight(height);
76}
77
78/**
79 * Retrieves the radius of the capsule.
80 */
81 float PhysxCapsuleShape::
82 get_radius() const {
83
84 nassertr(_error_type == ET_ok, 0.0f);
85 return _ptr->getRadius();
86}
87
88/**
89 * Retrieves the height of the capsule.
90 */
91 float PhysxCapsuleShape::
92 get_height() const {
93
94 nassertr(_error_type == ET_ok, 0.0f);
95 return _ptr->getHeight();
96}
PhysxCapsuleShapeDesc
Descriptor class for PhysxCapsuleShape.
Definition physxCapsuleShapeDesc.h:25
PhysxCapsuleShape::set_height
void set_height(float height)
Alters the height of the capsule.
Definition physxCapsuleShape.cxx:72
PhysxCapsuleShape::get_height
float get_height() const
Retrieves the height of the capsule.
Definition physxCapsuleShape.cxx:92
PhysxCapsuleShape::save_to_desc
void save_to_desc(PhysxCapsuleShapeDesc &shapeDesc) const
Saves the state of the shape object to a descriptor.
Definition physxCapsuleShape.cxx:52
PhysxCapsuleShape::set_radius
void set_radius(float radius)
Alters the radius of the capsule.
Definition physxCapsuleShape.cxx:62
PhysxCapsuleShape::get_radius
float get_radius() const
Retrieves the radius of the capsule.
Definition physxCapsuleShape.cxx:82
PhysxShape::set_name
void set_name(const char *name)
Sets a name string for this object.
Definition physxShape.cxx:100
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
physxCapsuleShapeDesc.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxCapsuleShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.