Hi All
I have sets of objects and all is perfectly working, Collision is fine between objects but because of the physics when 2 of the ships occupy the same space there is a slight position change as if to move away from colliding, same happens when 2 bullets are in the same space!
i have added the physics to the arrays as below, any ideas? can i cut the physics out?
physics.addBody(Ships[numOfShips], {density = 1, friction = 0, bounce = 0});
physics.addBody(Bullets[numOfBullets], {density = 1, friction = 0, bounce = 0});
because i am using 2 arrays of objects i have set collision
function onCollision(event)
if(event.object1.myName ==“bullets” and event.object2.myName ==“ships”) then
event.object1:removeSelf()
event.object1.myName=nil
event.object2:removeSelf()
event.object2.myName=nil
print(#Bullets)
print(#Ships)
end
if(event.object1.myName ==“ships” and event.object2.myName ==“bullets”) then
event.object1:removeSelf()
event.object1.myName=nil
event.object2:removeSelf()
event.object2.myName=nil
print(#Bullets)
print(#Ships)
end
end
Runtime:addEventListener(“collision” , onCollision)