Пример #1
0
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);

}
Пример #2
0
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);
}
Пример #3
0
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;
}
Пример #4
0
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 ;

}
Пример #5
0
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;
}
Пример #6
0
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);
}
Пример #7
0
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);
}