Is it possible to get the actual x, y of a collision of two objects? I know how to get the coordinates of the two respective shapes involved, but how to get the collision point in-between the two?
Thanks!
Previous discussion:
http://webcache.googleusercontent.com/search?q=cache:TeppklSrMdsJ:developer.coronalabs.com/forum/2011/10/27/get-xy-collision+&cd=1&hl=en&ct=clnk&gl=de (… http://developer.coronalabs.com/forum/2011/10/27/get-xy-collision)
The only thing I can think of is finding the midpoint of both objects’ coordinates.
local object1, object2 = event.object1, event.object2 local contactX, contactY = ( object1.x + object2.x ) \* 0.5, ( object1.y + object2.y ) \* 0.5
contactX and contactY would be the most likely spot where the two objects make contact in an onCollision event.
The only thing I can think of is finding the midpoint of both objects’ coordinates.
local object1, object2 = event.object1, event.object2 local contactX, contactY = ( object1.x + object2.x ) \* 0.5, ( object1.y + object2.y ) \* 0.5
contactX and contactY would be the most likely spot where the two objects make contact in an onCollision event.