Page 1 of 1

Joint controlled objects

Posted: Wed Sep 29, 2010 12:54 pm
by josemarin
Hi,

In my game I need that some objects only rotate (like in a windmill) and others that act like pistons (go from point A to B and back to A).

In this case, it's better to manually set the rotations and positions, or use joints? What joints would be better?

Thanks

Jose

Re: Joint controlled objects

Posted: Mon Oct 04, 2010 11:46 am
by josemarin
Well, I did some tests and I think that for the rotating objects the Hinge constraint will do, but I'm having a problem with the slider constraint (btSliderConstraint):
The behavior I need is a continuous piston movement (go from point A to point B, return to A and repeat the cycle forever).

But the controlled body stops the movement after a while.

That's the creation code:

btSliderConstraint* slider = new btSliderConstraint(*fixedBody1, *fixedBody2, frameInA, frameInB, true );

slider->setLowerAngLimit(0.0f);
slider->setUpperAngLimit(0.0f);
slider->setPoweredLinMotor(true);
slider->setTargetLinMotorVelocity(3);


Any tip?

Thanks.

Jose