예제 #1
0
/* Simple test of cpDampedRotarySpringSetRestAngle().
*/
void test_cpDampedRotarySpringSetRestAngle(void)
{
	cpConstraint *spring1 = cpDampedRotarySpringNew(body1, body2, 7, 1, 1);
	
	cpDampedRotarySpringSetRestAngle(spring1, M_PI_2);
	cpDampedRotarySpring *springCast = (cpDampedRotarySpring*)spring1;
	CU_ASSERT(springCast->restAngle == M_PI_2);

	cpDampedRotarySpringSetRestAngle(spring1, -M_PI);
	springCast = (cpDampedRotarySpring*)spring1;
	CU_ASSERT(springCast->restAngle == -M_PI);

	cpDampedRotarySpringSetRestAngle(spring1, 8);
	springCast = (cpDampedRotarySpring*)spring1;
	CU_ASSERT(springCast->restAngle == 8);
}
예제 #2
0
void PhysicsJointRotarySpring::setRestAngle(float restAngle)
{
    cpDampedRotarySpringSetRestAngle(_cpConstraints.front(), PhysicsHelper::float2cpfloat(restAngle));
}