ph_selectgroup ( var bitmask );

Starts physics simulation for all entities matching the provided bitmask. All physical entities not matching the bitmask will be frozen in time, making this function ideal for pausing all or some of the physical entities in your world. When your player moves out of viewing range of a physical entity (group) it is highly recommended to pause these objects so they don't need to be updated anymore, upon return you can then reenable the group.

Parameters:

bitmask - all registered physical entities with a group_id matching the bitmask will become active, those not matching the bitmask are paused. The bitmask is 21 bits; value 2097151 enables all objects

Returns:

1 if successful, 0 otherwise.

Remarks:

Here's a sample bitmask for ph_selectgroup( 6 ), where 6 corresponds to the bits 0110:

0

1

1

0


<- Bitmask (6), first four bits of 21 shown

Enabled ?

0

0

0

1


<- Ent1 group ID (1)

No

0

0

1

0


<- Ent2 group ID (2)

Yes

0

1

0

0


<- Ent3 group ID (4)

Yes

1

0

0

0


<- Ent4 and Ent5 group ID (8)

No

Speed:

Fast

Edition:

 A6   C   P 
 A7  all editions

Example:

phent_setgroup( ent1, 1 ); 
phent_setgroup( ent2, 2 );
phent_setgroup( ent3, 4 ); 
phent_setgroup( ent4, 8 );
phent_setgroup( ent5, 8 );
// activate ent1, all others are paused
ph_selectgroup( 1 );
// activate ent2 & ent3
ph_selectgroup( 6 );
// activate ent4 & ent5
ph_selectgroup( 8 );
// run them all
ph_selectgroup( 15 );

See also:

phent_setgroup