/* Simple test of cpDampedSpringSetStiffness().
*/
void test_cpDampedSpringSetStiffness(void)
{
	cpConstraint *spring1 = cpDampedSpringNew(body1, body2, cpv(13.2, 6.54), cpv(0, 0), 13, 50.48, 1);

	cpDampedSpringSetStiffness(spring1, 1.38);
	cpDampedSpring *springCast = (cpDampedSpring*)spring1;
	CU_ASSERT(springCast->stiffness == 1.38);

	cpDampedSpringSetStiffness(spring1, -2.74);
	springCast = (cpDampedSpring*)spring1;
	CU_ASSERT(springCast->stiffness == -2.74);

	cpDampedSpringSetStiffness(spring1, 11);
	springCast = (cpDampedSpring*)spring1;
	CU_ASSERT(springCast->stiffness == 11);
}
void PhysicsJointSpring::setStiffness(float stiffness)
{
    cpDampedSpringSetStiffness(_cpConstraints.front(), PhysicsHelper::float2cpfloat(stiffness));
}
Exemple #3
0
void DampedSpring::setStiffness(cpFloat value)
{
		cpDampedSpringSetStiffness(constraint,value);
}
void Spring::setStiffness(float stiffness){
	cpDampedSpringSetStiffness(constraint, stiffness);
}