Panda3D
Loading...
Searching...
No Matches
physxCapsuleController.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 physxCapsuleController.cxx
10 * @author enn0x
11 * @date 2009-09-24
12 */
13
15
16TypeHandle PhysxCapsuleController::_type_handle;
17
18/**
19 *
20 */
21void PhysxCapsuleController::
22link(NxController *controllerPtr) {
23
24 nassertv(controllerPtr->getType() == NX_CONTROLLER_CAPSULE);
25
26 // Link self
27 _ptr = (NxCapsuleController *)controllerPtr;
28 _error_type = ET_ok;
29
30 PhysxScene *scene = (PhysxScene *)_ptr->getActor()->getScene().userData;
31 scene->_controllers.add(this);
32
33 // Link actor
34 PT(PhysxActor) actor = new PhysxActor();
35 actor->link(_ptr->getActor());
36 actor->link_controller(this);
37}
38
39/**
40 *
41 */
42void PhysxCapsuleController::
43unlink() {
44
45 // Unlink actor
46 PT(PhysxActor) actor = (PhysxActor *)ptr()->getActor()->userData;
47 actor->unlink();
48
49 // Unlink self
50 _error_type = ET_released;
51
52 PhysxScene *scene = (PhysxScene *)_ptr->getActor()->getScene().userData;
53 scene->_controllers.remove(this);
54}
55
56/**
57 * Resets the controller's radius.
58 */
60set_radius(float radius) {
61
62 nassertv(_error_type == ET_ok);
63 _ptr->setRadius(radius);
64}
65
66/**
67 * Resets the controller's height.
68 */
70set_height(float height) {
71
72 nassertv(_error_type == ET_ok);
73 _ptr->setHeight(height);
74}
75
76/**
77 * Returns the controller's radius.
78 */
80get_radius() const {
81
82 nassertr(_error_type == ET_ok, 0.0f);
83 return _ptr->getRadius();
84}
85
86/**
87 * Returns the controller's height.
88 */
90get_height() const {
91
92 nassertr(_error_type == ET_ok, 0.0f);
93 return _ptr->getHeight();
94}
Actors are the main simulation objects.
Definition physxActor.h:44
void set_height(float height)
Resets the controller's height.
void set_radius(float radius)
Resets the controller's radius.
float get_height() const
Returns the controller's height.
float get_radius() const
Returns the controller's radius.
A scene is a collection of bodies, constraints, and effectors which can interact.
Definition physxScene.h:69
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.