Menu
IntroductionPhysics ObjectsForce EntitiesAdvanced UsageFurther Information
Feedback Functions
Gyro 2.1a

Any physics object may be assigned a feedback function to be triggered whenever it interacts with a force. This function may perform all manner of operations, such as changing physical properties or even destroying the object if it is subjected to an explosion force, for example. For an object to recieve feedback, you must first define an zero-argument function (or use the built-in Gyro_Object_FeedbackDebug() routine) to perform any necessary actions, then have your object's .gyro_object_feedback field point to it. Before feedback is called, three global variables will be set and may be used to influence the object's response:

string gyro_feedback_name
This string is the user-defined name of the force, specified during it's creation with Gyro_Force_Create(name, origin).

float gyro_feedback_power
Representation of the power the force exerted upon the object, relative to the object's mass.

float gyro_feedback_channels
A bitwise representation of the channels the force and object are interacting on.

Additionally, bouyant objects will receive the following feedback when they are submerged in water, slime or lava:

gyro_feedback_name     = "water"
gyro_feedback_power    = (object's bouyancy)
gyro_feedback_channels = 0.0

Bouyancy feedback saves the need to make manual pointcontent checks when objects need to behave differently underwater. Projectiles such as nails may need their movetype altered if they are to behave realistically under such conditions, which ties in closely with their behaviour under the influence of regular forces.