Ejemplo n.º 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);

}
Ejemplo n.º 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);
}
Ejemplo n.º 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;
}
Ejemplo n.º 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 ;

}
Ejemplo n.º 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;
}
Ejemplo n.º 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);
}
Ejemplo n.º 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);
}