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.
entity | registered Entity pointer (Actor) |
vecSpeed | Speed vector |
vecPos | Position where the speed is added. |
Nonzero if successful, 0 otherwise.
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 pXent_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.
pX_setgravity( nullvector ); pXent_setmass( my, 10 ); pXent_setdamping(my,0,0); pXent_addvellocal( my, vector(50,0,0), vector(100,0,0) );
pXent_addforcelocal, pXent_addtorquelocal, pXent_addforceglobal, pXent_addtorqueglobal, pXent_addvelcentral