Allow empty object2 in collideObjects

This commit is contained in:
samme 2018-05-02 16:54:39 -07:00
parent 5b0cb0faf3
commit 06677c2cdc

View file

@ -1410,8 +1410,17 @@ var World = new Class({
collideObjects: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly) collideObjects: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly)
{ {
var i; 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 object1isArray = Array.isArray(object1);
var object2isArray = Array.isArray(object2); var object2isArray = Array.isArray(object2);