phent_addvellocal(ENTITY*, VECTOR* vecSpeed, VECTOR* vecPos);
phent_addvelglobal(ENTITY*, VECTOR* vecSpeed, VECTOR* vecPos);
Adds linear and angular velocity to the specified entity, at the
position given by the vecPos vector in local (entity) or global
(world) coordinates. The vecSpeed vector
is independent of the object's current orientation.
Parameters:
ENTITY* |
Entity to be affected. |
vecSpeed |
Speed vector |
vecPos |
Position where the speed is added. |
Returns:
1 if successful, 0 otherwise.
Speed:
Fast
Remarks:
- If the the position is not at the entity center, the entity will spin.
If on the other hand vecPos is exactly at the object’s
center of mass, no spinning will occur (consider using phent_addvelcentral in
this case).
-
The function works by adding a force that is proportional to the entity's
mass. Unlike adding a real velocity, the force has the less effect on the
rotational speed, the closer to the entity center it is applied.
-
High speeds can cause objects to get
a very fast spin (like several thousand rotations
per second), which would cause a real object to explode by centrifugal forces.
A physics engine normally can't manage such rotation speeds either, and tends
to produce erratic behavior of the rotating object.
Example:
ph_setgravity( nullvector );
phent_setmass( my, 10 );
phent_setdamping (my, 0 );
phent_addvellocal( my, vector(50,0,0), vector(100,0,0) );
See also:
phent_addforcelocal, phent_addtorquelocal, phent_addforceglobal, phent_addtorqueglobal, phent_addvelcentral
► latest
version online