Merge pull request #3665 from samme/fix/collideHandler

Fix TypeError when colliding a group as the only argument
This commit is contained in:
Richard Davey 2018-05-18 12:55:49 +01:00 committed by GitHub
commit 45a186978c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1410,8 +1410,17 @@ var World = new Class({
collideObjects: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly)
{
var i;
object1 = object1.isParent && typeof(object1.physicsType) === 'undefined' ? object1.children.entries : object1;
object2 = object2.isParent && typeof(object2.physicsType) === 'undefined' ? object2.children.entries : object2;
if (object1.isParent && object1.physicsType === undefined)
{
object1 = object1.children.entries;
}
if (object2 && object2.isParent && object2.physicsType === undefined)
{
object2 = object2.children.entries;
}
var object1isArray = Array.isArray(object1);
var object2isArray = Array.isArray(object2);