A linear velocity is added to the entity’s center of mass. When there is no gravity and no damping, the entity will just continue to float with the direction and speed given by the speed vector, which is independent of the body's current orientation.
entity | registered Entity pointer (Actor) |
speed | a vector determining the speed to be added to the entity. |
Nonzero if successful, 0 otherwise.
For giving an entity a defined push, use this instruction rather than pXent_addforcecentral.
... pX_setgravity(nullvector); pXent_setmass(my,10); pXent_setdamping(my,0,0); pXent_addvelcentral(my,vector(50,0,0));
... while(1){ //Pushs the barrel if the character is 100 quants nearby if(vec_dist(character.x,barrel.x)<100){ VECTOR temp; vec_set(temp,barrel.x); vec_sub(temp,character.x); vec_normalize(temp,4); pXent_addvelcentral(barrel,temp); } wait(1); }