Collision points. How to determine where collision was?

Is there any way to return collision points (x,y)? [import]uid: 110918 topic_id: 22342 reply_id: 322342[/import]

No. But you can check to see where the collision of the two objects are in relation to each other. This is what I do and it can help you determine about where the collision took place.

if event.object1.myName == "orangebreakablebrick" and event.object2.myName == "smallHero" and event.object2.y \> event.object1.y+31 then  
 -- awesome smash brick code goes here  
end  

The code above I use in a collision listener to determine if the hero hit a brick from underneath it. Of course you can check x positions as well if you want to get even more accurate. [import]uid: 38820 topic_id: 22342 reply_id: 89057[/import]

There is a way to get the x and y points of the objects at time of collision

[code]
–Collision
local function onLocalCollision(event)
local obj1 = event.object1
local obj2 = event.object2

–Began
if event.phase == “began” then
print("object1.x is : ", obj1.x)
print("object2.x is : ", obj2.x)
print("object1.y is : ", obj1.y)
print("object2.y is : ", obj2.y)
–Ended
elseif event.phase == “ended” then

end

return true
end

Runtime:addEventListener(“collision”, onLocalCollision) [import]uid: 84637 topic_id: 22342 reply_id: 89078[/import]

Thanks :slight_smile: So, the only way to get collision points is to create small, invisible objects around the other object, that will be visible? [import]uid: 110918 topic_id: 22342 reply_id: 89559[/import]

I suppose you COULD do it that way if you want, but you can check which bits of obj1 are touching obj2. [import]uid: 10389 topic_id: 22342 reply_id: 89762[/import]

What is bit? Those points that creates physical shape of an object?
Please, show me how to do it :)))) [import]uid: 110918 topic_id: 22342 reply_id: 89763[/import]