phent_setelasticity (ENTITY* entity, var bounciness, var minSpeed );
The obvious difference between a rubber ball and a metal ball is the way it bounces off other objects. This behavior can be set using phent_setelasticity. Bounciness specifies the percentage of bouncing off other objects- 100 is a perfectly elastic collision like that of a rubber ball, 0 is a perfectly plastic collision, like that of a piece of clay.
Because entities are constantly drawn downwards by gravity (if gravity is enabled),
they are constantly colliding with the floor- if you don't want objects to bounce
around the floor, set a minimum speed for elastic behavior. If the object is
falling from a certain height it will gain speed and bounce off the floor. If
it is merely a few quants from the floor, it won't gain much speed, and if the
collision speed is below minimumSpeed the collision will be plastic making the
object stay where it hits the surface. minimumSpeed is used for all collisions,
not just object-floor ones. The effective elasticity depends on both objects
and is calculated by multiplying both bounciness factors. Therefore a rubber
ball (bounciness= 90) and a clay ball (bounciness=0) will result in clay-like,
plastic collisions (0*90 = 0). Level geometry has a bounciness of 100 percent,
so it's only dependent on the colliding object.
Parameters:
entity
the entity to be affected
bounciness
value between 0..100, indicating how much colliding object bounce off each other
minSpeed
for all collisions with speeds slower than this, bounciness will be set to 0
Returns:
1 if successful, 0 otherwise.
Remarks:
EVENT_FRICTION is only triggered at speeds above the minimum speed.