phent_addcentralforce ( ENTITY*, VECTOR* vForce );
A linear force is applied to the entity's center of mass during the following
frame cycle. When there is no gravity and no damping, the entity will
accelerate along the direction
given by vecForce,
which is independent of the body's current orientation.
||Entity to be affected
||Vector determining the force to be exerted on the entity at
its center of mass
1 if successful, 0 otherwise.
Force accelerates entities according to the Newton formula speed = time
* force / mass. Thus for higher acceleration or heavier
entities you have to use a stronger force or apply them during a
- Avoid applying forces for a frame rate dependent time. In the worst
case - when
applying a force for one frame cycle only (time_frame) -
the entities' speed will be detemined by the frame rate.
When the engine frame rate is higher than the physics update rate
it can even happen that no physics update occurs in the
frame cycle and the entity is not accelerated at all.
- If you want
to accelerate the entity to a certain speed regardeless of the
frame rate, use phent_addvelcentral instead.
- Forces are additive, i.e. calling this function twice doubles the
- For efficiency reasons you should prefer phent_addcentralforce to phent_addforceglobal, when possible.
ph_setgravity( nullvector );
phent_setmass( my, 10 );
phent_setdamping (my, 0 );
// now my will continue to move along the x axis forever, with constant speed
phent_addcentralforce( my, vector(50,0,0));