EVENT_FRICTION

ENABLE_FRICTION

If a physics entity collides with an obstacle, this event is triggered. If two physics entities collide, each can trigger an EVENT_FRICTION event.

Modifies:

hit.x,y,z Contact point.
hit.nx,ny,nz Normal vector of the hit surface
you Obstacle entity, or NULL for collision with the level.

Example:

function bounce_event()
{
  if (event_type == EVENT_FRICTION) 
  {
    ent_playsound(my,whamm,50);
  }
}


action bounceball() 
{
  pXent_settype(my,PH_RIGID,PH_SPHERE);
  pXent_setcollisionflag(my,NULL,NX_NOTIFY_ON_START_TOUCH); 
  my.event = bounce_event;
  ...
}

See also:

event, pXent_setcollisionflag, hit

► latest version online