Slider Joint unable to work with motor

Hello Guys,

I am new to jmonkey. recently i am trying to build a robotic arm in jmonkey with physics integration. I am able to get Hinge joint working. But Slider joint is not working . I mean i couldn’t able to make it work. I am able to create the joint the way i create the hinge joint. I am unable to find a function like “enableMotor()” of hinge joint. can any body suggest me how to set hinge joint .

regards
Bharath

Hello bha123, you have to use the sliderJoint.setTargetLinMotorVelocity(targetLinMotorVelocity); to translate the slider and
sliderJoint.setTargetAngMotorVelocity(targetAngMotorVelocity); to rotate the slider. Don’t forget to set the following properties, or the slider will not work:

For translation:

sliderJoint.setLowerLinLimit(lowerLinLimit);
sliderJoint.setUpperLinLimit(upperLinLimit);
sliderJoint.setMaxLinMotorForce(maxLinMotorForce);
sliderJoint.setPoweredLinMotor(true);

For rotation:

sliderJoint.setLowerAngLimit(lowerAngLimit);
sliderJoint.setUpperAngLimit(upperAngLimit);
sliderJoint.setMaxAngMotorForce(maxAngMotorForce);
sliderJoint.setPoweredAngMotor(true);

cya

3 Likes

Thanks glaucomardano it is working.