Is it possible to create an invisible object that you can use for collision detection, but without objects interacting with it. For instance, make a certain area on the screen where if an object falls in that area it detects it, but the object doesn’t physically interact? [import]uid: 116264 topic_id: 24720 reply_id: 324720[/import]
local groundShape = { -240,-20, 240,-20, 240,20, -240,20 }
local ground = display.newRect( 100, 100, 0, 0 )
physics.addBody( ground, "static", { shape = groundShape, isSensor = true } )
[import]uid: 77199 topic_id: 24720 reply_id: 100176[/import]
Yes, the above solution is correct… the key aspect in that code being “isSensor = true”. Also, be careful with “static” physics objects, which might not interact with “kinematic” objects. In most cases you need at least one body in any collision to be “dynamic” (which is the default). It’s late and I can’t remember the exact rules about what can interact with what, but if you aren’t getting the expected collision detections, that is a common cause of it.
Brent [import]uid: 9747 topic_id: 24720 reply_id: 100234[/import]