pXent_setmaxspeed ( entity, var maxangular);

By default objects have no speed limit assigned to them, which can lead to problems such as an object leaving the level or showing other unintended behavior. pXent_setmaxspeed acts as a safety net to reduce this problem by halting an object if it goes beyond the specified speed limits. If an object rotates with an angular speed faster than the specified maxangular limit, it will stop spinning (angular velocity will be reset to 0).

Parameters:

entity registered Entity pointer (Actor)
maxangular max rotation speed (default: 7)

Returns:

Nonzero if successful, 0 otherwise.

Remarks:

Speed:

Fast

Example:

action MyObject() {
  var mySpeed[3]; // stores current speed
  pXent_settype(my, PH_RIGID, PH_SPHERE);
  phent_setmaxspeed( my, 10);

  while (1) {
// query translational speed
    pXent_getvelocity(my, mySpeed, nullvector);
    if (vec_length(mySpeed)>50)
// too fast ? yank up damping for a while
      pXent_setdamping(my, 100, 100);
    else 
// 10 percent damping by default
      pXent_setdamping(my, 10, 10);
    wait(1);
  }
}

See also:

pXent_setdamping, pXent_addforceglobal