Type Boolean Object Body Library physics.* Revision Current Public Release (2017.3184) Keywords body, isSensor
A sensor is a fixture that detects collisions but does not produce a physical response. Sensors do not generate contact points.
isSensor property is a
true, prevents any visible collisions from happening to the object, although
"ended" collision events are still fired.
For one-sided platforms that a jumping character can pass through from below but should land upon from above, the
isSensor property may not be sufficient to handle all cases. Instead, consider the isEnabled property of the PhysicsContact object.
isSensor is a property for a specific fixture or, in Corona terms, a "body element" — it is not a property of the entire body. However, Corona does not currently expose access to individual body elements after the body is created, so it's not possible to set properties on individual body elements following creation of the body. Consequently, setting
isSensor = true
isSensor property will permanently override the individual body element settings.
local laserBeam = display.newImage( "laserBeam.png" ) physics.addBody( laserBeam, "dynamic" ) laserBeam.gravityScale = 0 -- Make the object a "bullet" type object laserBeam.isBullet = true -- Make the object a sensor laserBeam.isSensor = true laserBeam:setLinearVelocity( 400, 0 )