コード例 #1
0
/* Simple test of cpDampedRotarySpringGetRestAngle().
*/
void test_cpDampedRotarySpringGetRestAngle(void)
{
	cpConstraint *spring1 = cpDampedRotarySpringNew(body1, body2, 7, 1, 1);
	CU_ASSERT(cpDampedRotarySpringGetRestAngle(spring1) == 7);

	cpConstraint *spring2 = cpDampedRotarySpringNew(body1, body2, -11.7, 1, 1);
	CU_ASSERT(cpDampedRotarySpringGetRestAngle(spring2) == -11.7);

	cpConstraint *spring3 = cpDampedRotarySpringNew(body1, body2, 0, 1, 1);
	CU_ASSERT(cpDampedRotarySpringGetRestAngle(spring3) == 0);

	cpConstraint *spring4 = cpDampedRotarySpringNew(body1, body2, 16.38, 1, 1);
	CU_ASSERT(cpDampedRotarySpringGetRestAngle(spring4) ==16.38);
}
コード例 #2
0
float PhysicsJointRotarySpring::getRestAngle() const
{
    return PhysicsHelper::cpfloat2float(cpDampedRotarySpringGetRestAngle(_cpConstraints.front()));
}