Panda3D
physxRevoluteJointDesc.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 physxRevoluteJointDesc.cxx
10  * @author enn0x
11  * @date 2009-09-28
12  */
13 
14 #include "physxRevoluteJointDesc.h"
15 #include "physxSpringDesc.h"
16 #include "physxMotorDesc.h"
17 #include "physxJointLimitDesc.h"
18 
19 /**
20  * Sets the distance beyond which the joint is projected.
21  */
23 set_projection_distance(float distance) {
24 
25  _desc.projectionDistance = distance;
26 }
27 
28 /**
29  * Sets the angle beyond which the joint is projected.
30  */
32 set_projection_angle(float angle) {
33 
34  _desc.projectionAngle = angle;
35 }
36 
37 /**
38  * Sets an aptional spring.
39  */
41 set_spring(const PhysxSpringDesc &spring) {
42 
43  _desc.spring = spring._desc;
44 }
45 
46 /**
47  * Sets or clears a single RevoluteJointFlag flag.
48  */
50 set_flag(PhysxRevoluteJointFlag flag, bool value) {
51 
52  if (value == true) {
53  _desc.flags |= flag;
54  }
55  else {
56  _desc.flags &= ~(flag);
57  }
58 }
59 
60 /**
61  * Use this to enable joint projection. Default is PM_none.
62  */
64 set_projection_mode(PhysxProjectionMode mode) {
65 
66  _desc.projectionMode = (NxJointProjectionMode)mode;
67 }
68 
69 /**
70  * Sets an optional joint motor.
71  */
73 set_motor(const PhysxMotorDesc &motor) {
74 
75  _desc.motor = motor._desc;
76 }
77 
78 /**
79  * Sets optional limits for the angular motion of the joint.
80  */
83 
84  _desc.limit.low = low._desc;
85 }
86 
87 /**
88  * Sets optional limits for the angular motion of the joint.
89  */
92 
93  _desc.limit.high = high._desc;
94 }
95 
96 /**
97  * Return the distance beyond which the joint is projected.
98  */
100 get_projection_distance() const {
101 
102  return _desc.projectionDistance;
103 }
104 
105 /**
106  * Return the angle beyond which the joint is projected.
107  */
109 get_projection_angle() const {
110 
111  return _desc.projectionAngle;
112 }
113 
114 /**
115  *
116  */
117 PhysxSpringDesc PhysxRevoluteJointDesc::
118 get_spring() const {
119 
120  PhysxSpringDesc value;
121  value._desc = _desc.spring;
122  return value;
123 }
124 
125 /**
126  *
127  */
128 bool PhysxRevoluteJointDesc::
129 get_flag(PhysxRevoluteJointFlag flag) const {
130 
131  return (_desc.flags & flag) ? true : false;
132 }
133 
134 /**
135  *
136  */
137 PhysxEnums::PhysxProjectionMode PhysxRevoluteJointDesc::
138 get_projection_mode() const {
139 
140  return (PhysxProjectionMode)_desc.projectionMode;
141 }
142 
143 /**
144  * Sets an optional joint motor.
145  */
147 get_motor() const {
148 
149  PhysxMotorDesc value;
150  value._desc = _desc.motor;
151  return value;
152 }
153 
154 /**
155  *
156  */
157 PhysxJointLimitDesc PhysxRevoluteJointDesc::
158 get_limit_low() const {
159 
160  PhysxJointLimitDesc value;
161  value._desc = _desc.limit.low;
162  return value;
163 }
164 
165 /**
166  *
167  */
168 PhysxJointLimitDesc PhysxRevoluteJointDesc::
169 get_limit_high() const {
170 
171  PhysxJointLimitDesc value;
172  value._desc = _desc.limit.high;
173  return value;
174 }
Describes a joint limit.
Describes a joint motor.
float get_projection_angle() const
Return the angle beyond which the joint is projected.
void set_limit_high(const PhysxJointLimitDesc &high)
Sets optional limits for the angular motion of the joint.
void set_motor(const PhysxMotorDesc &motor)
Sets an optional joint motor.
void set_spring(const PhysxSpringDesc &spring)
Sets an aptional spring.
void set_limit_low(const PhysxJointLimitDesc &low)
Sets optional limits for the angular motion of the joint.
float get_projection_distance() const
Return the distance beyond which the joint is projected.
PhysxMotorDesc get_motor() const
Sets an optional joint motor.
void set_projection_angle(float angle)
Sets the angle beyond which the joint is projected.
void set_projection_mode(PhysxProjectionMode mode)
Use this to enable joint projection.
void set_flag(PhysxRevoluteJointFlag flag, bool value)
Sets or clears a single RevoluteJointFlag flag.
void set_projection_distance(float distance)
Sets the distance beyond which the joint is projected.
Describes a joint spring.
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.