phent_setgroup ( ENTITY* entity, var groupID );

Sets the entity's ID. This number is used in subsequent calls to ph_selectgroup, for enabling or disabling physical entities. You can assign each object an individual ID or set multiple objects to share a single ID number. However, you must not use 0 as GroupID, cause this would always disable the entity. Every new entity is assigned to group 1 by default. So you don't have to call phent_setgroup unless you want better control of which objects are enabled or should collide with each other.

Collision checking is disabled for objects of the same group ID (except group 0 and 1). Thus if you want two objects to not have collision detection with each other, set them to the same group ID of 2 or higher.

Parameters:

entity the entity to be affected
groupID new ID number of the object, should be 2 or higher !

Returns:

1 if successful, 0 otherwise.

Remarks:

Speed:

Fast

Example:

// player collides with bot and forcefield, but bot can walk through the forcefield
phent_setgroup( player, 2 );
phent_setgroup( forcefield, 4 );
phent_setgroup( patrolling_bot, 4 );

while (1) {
  if (player_inside_building) {
    ph_selectgroup( 1+2+4 ); // activate group 1+2+4
  } else {
    ph_selectgroup( 1+2 ); // disable group 4 cause player has left the building
  }
}

See also:

ph_selectgroup ► latest version online