In some cases, it may be beneficial for certain objects to be ignored when calculating force interactions - a magnet, for example, should not attract non-metallic objects. To facilitate this filtering, objects and forces may each be assigned to one or more force channels, and interactions will only be performed if the two share a common channel. In the previous example, this may be the magnetic channel. The gyro_user.qc
file provides a collection of sample channels for your convenience but, since Gyro does not directly use any of them, you are free to create your own (remember to define them as seperate bit values). The only exception is GYRO_CHANNEL_DEFAULT
, to which all objects and forces are automatically added upon their creation. Channels may be assigned with the following functions:
Gyro_Object_SetChannels(entity object, float channels)
Gyro_Force_SetChannels(entity force, float channels)
These functions will directly set the active force channels of an object or force, overwriting any previous channel information. Since channels are stored as bits, you may use bitwise operators to assign to more than one channel, as so: GYRO_CHANNEL_DEFAULT | GYRO_CHANNEL_ORGANIC
.
Gyro_Object_AddChannels(entity object, float channels)
Gyro_Force_AddChannels(entity force, float channels)
Assigns an object or force to the given channel(s) while retaining any existing channel information.
Gyro_Object_RemoveChannels(entity object, float channels)
Gyro_Force_RemoveChannels(entity force, float channels)
Removes an object or force from the given channel(s).