hitTest Sensitivity Issues (HTML5 Canvas)
Hello,
I'm attempting to use the hitTest method to detect when two objects collide, quite similar to a createJS demo (EaselJS/globalToLocal.html at master · CreateJS/EaselJS · GitHub)
I have added 10 objects to a container called 'holder', and I'm attempting to detect when an object called 'player' collides with any children of 'holder'. My code (within a ticker function) is similar to the following:
var h = holder.getNumChildren();
for (var i=0; i<h; i++){
var child = holder.getChildAt(i)
var pt = child.localToLocal(0, 0, player);
if (child.hitTest(pt.x, pt.y)){
score++;
}
}
The code works for detecting collision, however the sensitivity of the objects colliding seems very low. By this, I mean that the 'player' object must be colliding with the center of the child object to return true and add to the score. If the player is touching, but not colliding with the center of the child, it will not return true.
Is there anyway to make the objects more sensitive to collision detection so any spot on the objects colliding returns true? It may be worth noting that all objects are constantly moving and do not stay in a specific coordinate.
Thanks
