phent_addforcelocal ( entity, vecForce, vecPoint );
Force and torque (=“angular force”) will be applied to the specified entity, at local position vecPoint. This allows applying a constant force at a constant point without having to worry about the objects current orientation. This is suitable for flight sims where the propulsion always points along a body relative direction (forward) and is also applied at a body relative position, say at the plane's tail.
It is not checked whether the position is actually inside the entity, so by choosing a vecPoint to lie far away from the entity, you can give it a strong spin. If on the other hand vecPoint is exactly at the object’s center of mass, no spinning will occur (consider using phent_addcentralforce in this case). phent_addforcelocal gives the same result as calling both phent_addcentralforce and phent_addtorquelocal with the same parameters.
Force is defined as the product of mass and acceleration. Thus for higher acceleration or heavier entities you have to use a stronger force.
Parameters:
| entity |
the entity to be affected |
| vecForce |
a vector determining the force to be exerted on entity (relative to body's orientation) |
| vecPoint |
a vector specifying the local point where vecForce is applied (relative to body position) |
Returns:
1 if successful, 0 otherwise.
Remarks:
- This function now also works with PH_WAVE entities. When used with such,
vecpoint is a local coordinate of the terrain object. vecforce.z gives
the amount of initial water displacement in Z direction. The valid
range for vecforce.z is -1 to +1, where this value is relative to the
general terrain size. E.g. a value of 1 corresponds to the distance
from one vertex to its neighbor in x direction; a value of 0.5 then
would be have this distance. It's a good idea to use small values here.
- On a water entity, this instructions creates a distortion at the loca
position vecpoint of the water entity with intensity vecforce.z. Only
the z component is used (not x,y) and the value must be between -1 and
+1.
Speed:
fast
Edition:
C P
Example:
phent_addforcelocal(my, vector(10,0,0), nullvector);
See also:
phent_addforceglobal, ph_selectgroup