physics_fixture_set_sensor


描述

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.

注意: 当碰撞 首次发生时,感应器固定装置将触发碰撞事件,这意味着当两个物体继续重叠时,你不会得到碰撞事件流。(一般来说是这样)。如果它们停止重叠并且随后再次重叠,则会触发另一个碰撞事件。


语法:

physics_fixture_set_sensor(fixture, state)

参数 描述
fixture the index of the fixture
state whether a fixture is a sensor (true) or not (false)


Returns:

N/A(无返回值)


例如:

physics_fixture_set_sensor(fix_Cloud, 1);

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