Forces make up the second half of Gyro's subsystems and can represent anything from a thunderous explosion to a gentle gust of wind. They are created by combining a series of individual components to produce a final, tangible result. You can create and manipulate forces with the following functions:
Gyro_Force_Create(string forcename, vector origin)
This function will create an empty force at the specified origin. Unlike many of Gyro's routines, this will return an entity reference to the newly created force, which you will need to retain in order to apply components and possibly to remove the force when you no longer need it. It is not recommended that you treat the force entity as a standard entity, although you may safely use the .think
and .nextthink
if required. The force name is used for identification during debugging and for the feedback function and may be any string you feel is appropriate.
Gyro_Force_Remove(entity force)
Removes the specified force entity from the game. You may also call the standard remove()
function directly, but this is not advised and may break compatibility in later versions of Gyro.
Once an empty force has been created, you should apply some components to it so it may interact with your physics objects. The following component types and functions are available:
Affector components
Falloff components
Property components
Miscellaneous controls
Due to the initial learning curve involved with the components, several useful forces have been pre-built as macros within the gyro_user.qc
file to serve as examples and starting points for your own forces. They are not bound to any of the core Gyro code, so you are free to edit them or add your own macros to the list.