What unit is setMaxLinMotorForce in?

heeen
Posts: 6
Joined: Tue Feb 17, 2009 6:32 pm

What unit is setMaxLinMotorForce in?

Post by heeen »

I just played around a bit with setMaxLinMotorForce on a slider constraint, but I am not clear on what unit the motor force is in.
I modeled a sliding door with a box blocking it, and with 10 (Newton?) it was enough to make the box jump from the doorframe instead of just blocking the door. Seems a bit excessive to me.
User avatar
rponomarev
Posts: 56
Joined: Sat Mar 08, 2008 12:37 am

Re: What unit is setMaxLinMotorForce in?

Post by rponomarev »

Hello,

The definition of the maxLinMotorForce may be a little bit confusing
Actually it sets limits for the applied impulse for the constraint solver.
To set it in newtons you should use the following formula:

slider->setMaxLinMotorForce(maxForceInNewtons * dt * dt);

where dt is the simulation time interval (1/60 sec by default)


Note, that it sets limits and not the actual force. If you set a relatively large
value, the body will achieve the desived velocity set by setTargetLinMotorVelocity()
for one simulation step.

Thanks,
Roman