physics_fixture_set_sensor

This function tells GameMaker Studio 2 that the fixture is to be treated as a sensor only.

Syntax:

physics_fixture_set_sensor(fixture, state)


Argument Description
fixture the index of the fixture
state whether a fixture is a sensor (true) or not (false)


Returns: N/A


Description

Some times you will want your game to detect and recognise when two instances with fixtures collide, but not have any physical reaction to the collision. This can be done by converting the fixture into a sensor, which basically means that they will generate a collision event but with no physical response so that you can use these instances as "triggers" for other events to happen in the game room. Any fixture can be flagged as a sensor, and it makes no difference if the instance it is bound to is static or in movement.

NOTE: A sensor fixture will fire off the collision event when the collision first occurs only, meaning you don't get a stream of collision events as the two bodies continue to overlap (which is what would traditionally occur). If they stop overlapping and overlap subsequently there will be another collision event triggered.


Example:

physics_fixture_set_sensor(fix_Cloud, 1);

The code above will turn the sensor state of the fixture indexed in "fix_Cloud" to true.


Back: Fixtures
Next: physics_fixture_set_kinematic
© Copyright YoYo Games Ltd. 2018 All Rights Reserved