Collision direction detection
by Steven Hine · in Torque Game Builder · 10/09/2008 (5:38 pm) · 2 replies
Is there a method of detecting where a collision occurred on an object? Like did one object hit the top, bottom, right, or left of the source object.
About the author
Associate Phillip O'Shea
Violent Tulip
function myClass::onCollision(%srcObject, %dstObject, %srcRef, %dstRef, %time, %normal, %contacts, %points) { %normalX = getWord(%normal, 0); %normalY = getWord(%normal, 1); if (%normalY != 0) { if (%normalY < 0) echo ("top"); else echo ("bottom"); } if (%normalX != 0) { if (%normalX < 0) echo ("left"); else echo ("bottom"); } }