15 #include "physxRevoluteJoint.h" 16 #include "physxRevoluteJointDesc.h" 17 #include "physxJointLimitDesc.h" 18 #include "physxMotorDesc.h" 19 #include "physxSpringDesc.h" 28 void PhysxRevoluteJoint::
29 link(NxJoint *jointPtr) {
31 _ptr = jointPtr->isRevoluteJoint();
32 _ptr->userData =
this;
38 scene->_joints.add(
this);
46 void PhysxRevoluteJoint::
49 _ptr->userData = NULL;
50 _error_type = ET_released;
53 scene->_joints.remove(
this);
65 nassertv(_error_type == ET_ok);
66 _ptr->saveToDesc(jointDesc._desc);
78 nassertv(_error_type == ET_ok);
79 _ptr->loadFromDesc(jointDesc._desc);
98 nassertr(_error_type == ET_ok, 0.0f);
99 return NxMath::radToDeg(_ptr->getAngle());
112 nassertr(_error_type == ET_ok, 0.0f);
113 return _ptr->getVelocity();
124 nassertv(_error_type == ET_ok);
125 _ptr->setProjectionMode((NxJointProjectionMode)mode);
136 nassertr(_error_type == ET_ok, PM_none);
137 return (PhysxProjectionMode)_ptr->getProjectionMode();
146 set_flag(PhysxRevoluteJointFlag flag,
bool value) {
148 nassertv( _error_type == ET_ok );
149 NxU32 flags = _ptr->getFlags();
158 _ptr->setFlags(flags);
169 nassertr(_error_type == ET_ok,
false);
170 return (_ptr->getFlags() & flag) ?
true :
false;
205 nassertv(_error_type == ET_ok);
206 _ptr->setSpring(spring._desc);
243 nassertv(_error_type == ET_ok);
244 _ptr->setMotor(motor._desc);
280 nassertv(_error_type == ET_ok);
282 NxJointLimitPairDesc limits;
283 limits.low = low._desc;
284 limits.high = high._desc;
285 _ptr->setLimits(limits);
296 nassertr(_error_type == ET_ok, NULL);
299 _ptr->getMotor(value._desc);
311 nassertr(_error_type == ET_ok, NULL);
314 _ptr->getSpring(value._desc);
Descriptor class for distance joint.
void set_flag(PhysxRevoluteJointFlag flag, bool value)
Sets or clears a single RevoluteJointFlag.
void load_from_desc(const PhysxRevoluteJointDesc &jointDesc)
Loads the entire state of the joint from a descriptor with a single call.
float get_velocity() const
Retrieves the revolute joint angle's rate of change (angular velocity).
Describes a joint spring.
A scene is a collection of bodies, constraints, and effectors which can interact. ...
void save_to_desc(PhysxRevoluteJointDesc &jointDesc) const
Saves the state of the joint object to a descriptor.
void set_spring(const PhysxSpringDesc &spring)
Sets spring parameters.
bool get_flag(PhysxRevoluteJointFlag flag) const
Returns the value of a single RevoluteJointFlag.
void set_name(const char *name)
Sets a name string for this object.
float get_angle() const
Retrieves the current revolute joint angle.
TypeHandle is the identifier used to differentiate C++ class types.
void set_motor(const PhysxMotorDesc &motor)
Sets motor parameters for the joint.
void set_projection_mode(PhysxProjectionMode mode)
Sets the joint projection mode.
void set_limits(const PhysxJointLimitDesc &low, const PhysxJointLimitDesc &high)
Sets angular joint limits.
PhysxProjectionMode get_projection_mode() const
Retrieves the joints projection mode.