Hello everyone,
I am facing an issue with the detection of collision.My both objects are dynamic and what I want to do is just print a statement when the collision happens.
Receiving help from you all is of great fortune to me.
Below is the code:
local rec=display.newRect(200,200,80,80) tab={-40,-40,-40,80,40,80,40,-40} rec.name="rect" physics.addBody( rec, "dynamic",{shape=tab}) rec:setLinearVelocity( 0, -330 ) local ball=display.newCircle( 200, 100, 30 ) ball.name="ball" physics.addBody( ball, "dynamic") function onCollison(self,event) if event.phase=="ended" then if event.other.name=="ball" then print(true) end end end rec.collision=onCollision rec:addEventListener( "collision", rec )
Every suggestion is welcome.
Thanks and regards,
Swanand Thakur.