pXent_addforceglobal ( entity,VECTOR* vForce,VECTOR* vPos );


pXent_addforcelocal ( entity,VECTOR* vForce,VECTOR* vPos );

Force and torque ("angular force") will be applied to the specified entity, at global (world coordinates) or local (entity coordinates) position vPos. The force vector is independent of the objects current orientation. It is not checked whether the position is actually inside the entity, so by choosing a vPos far away from the entity, you can give it a strong spin. If vPos is exactly at the object's center of mass, no spinning will occur (consider using pXent_addforcecentral in this case).

Parameters:

entity registered Entity pointer (Actor)
vForce Vector determining the force to be exerted on entity
vPos Vector specifying the point where vForce is applied


Returns:

1 if successful, 0 otherwise.

Remarks:

Speed:

Fast

Example:

entity* myCrate;
var gravity[3] = 0,0, -386;
var crateMass= 10;
pXent_settype( myCrate, PH_RIGID, PH_BOX );
pXent_setmass( crateMass, 1);
// force is three times as strong as gravity's pull, so we can lift up the entity, while pressing a key
while (key_pressed( key_for_str("L")) )
{
  vec_set( temp, gravity );
  vec_scale( temp, -3 * crateMass ); 
  pXent_addforceglobal( myCrate, nullvector, temp );
  wait(1);
}

See also:

pXent_addforcelocal, pX_selectgroup, pXent_addforcecentral, pX_setforcemode