pXent_setdamping ( entity, var linear, var angular ); |
A simple way to simulate airdrag and friction is to use velocity damping. Each frame a force & torque gets applied to the selected entity, compensating its movement. An amount of 0 disables damping and unless stopped by other objects or forces, a moving physical entity will continue moving indefinitely. When set to 100%, the object will only move while a force or torque is applied to it.
Parameters: |
entity |
registered Entity pointer (Actor) |
linear |
amount of linear damping, between 0.0 and 100.0 |
angular |
amount of angular damping, between 0.0 and 100.0 |
Returns: |
1 if successful, 0 otherwise.
Remarks: |
As long as linear or angular damping is enabled for an object calculations need to be performed each frame. Set both to 0 to increase frame rate.
Speed: |
Fast
pXent_setdamping ( my, 50, 50 ); // both set to 50% damping