void pJointBall::setSwingLimitAxis( const VxVector& swingLimitAxis ) { NxSphericalJointDesc descr; NxSphericalJoint *joint = static_cast<NxSphericalJoint*>(getJoint()); if (!joint)return ; joint->saveToDesc(descr); descr.swingAxis = pMath::getFrom(swingLimitAxis); joint->loadFromDesc(descr); }
void pJointBall::enableCollision( bool collision ) { NxSphericalJointDesc descr; NxSphericalJoint *joint = static_cast<NxSphericalJoint*>(getJoint()); if (!joint)return ; joint->saveToDesc(descr); if (collision) { descr.jointFlags |= NX_JF_COLLISION_ENABLED; }else descr.jointFlags &= ~NX_JF_COLLISION_ENABLED; joint->loadFromDesc(descr); }
bool pJointBall::setJointSpring( pSpring spring ) { NxSphericalJointDesc descr; NxSphericalJoint *joint = static_cast<NxSphericalJoint*>(getJoint()); if (!joint)return false ; joint->saveToDesc(descr); NxSpringDesc sLimit; sLimit.damper = spring.damper;sLimit.spring=spring.spring;sLimit.targetValue=spring.targetValue; if (!sLimit.isValid())return false; descr.jointSpring= sLimit; joint->loadFromDesc(descr); return 1; }
void pJointBall::enableFlag(int flag,bool enable) { NxSphericalJointDesc descr; NxSphericalJoint *joint = static_cast<NxSphericalJoint*>(getJoint()); if (!joint)return; joint->saveToDesc(descr); if (enable) descr.flags |=flag; else descr.flags &=~flag; joint->loadFromDesc(descr); return ; }
bool pJointBall::setSwingLimit( pJointLimit limit ) { NxSphericalJointDesc descr; NxSphericalJoint *joint = static_cast<NxSphericalJoint*>(getJoint()); if (!joint)return false ; joint->saveToDesc(descr); if ( limit.hardness != 0.0f || limit.restitution != 0.0f || limit.value !=0.0f ) { enableFlag(NX_SJF_SWING_LIMIT_ENABLED,1); NxJointLimitDesc sLimit; sLimit.value = limit.value;sLimit.restitution = limit.restitution;sLimit.hardness = limit.hardness; if (!sLimit.isValid())return false; descr.swingLimit= sLimit; joint->loadFromDesc(descr); return true; }else { enableFlag(NX_SJF_SWING_LIMIT_ENABLED,0); } return false; }
void pJointBall::setProjectionMode(ProjectionMode mode) { NxSphericalJointDesc descr; NxSphericalJoint *joint = static_cast<NxSphericalJoint*>(getJoint()); if (!joint)return ; joint->saveToDesc(descr); descr.projectionMode = (NxJointProjectionMode)mode; joint->loadFromDesc(descr); }
void pJointBall::setProjectionDistance(float distance) { NxSphericalJointDesc descr; NxSphericalJoint *joint = static_cast<NxSphericalJoint*>(getJoint()); if (!joint)return ; joint->saveToDesc(descr); descr.projectionDistance= distance; joint->loadFromDesc(descr); }