Skip to content

Commit ccb2878

Browse files
committed
Physics Group now added to the update list properly
1 parent 84a86ae commit ccb2878

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

v3/src/physics/arcade/Factory.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ var CONST = require('./const');
55
var PhysicsGroup = require('./PhysicsGroup');
66
var StaticPhysicsGroup = require('./StaticPhysicsGroup');
77

8+
// When registering a factory function 'this' refers to the GameObjectFactory context.
9+
//
10+
// There are several properties available to use:
11+
//
12+
// this.scene - a reference to the Scene that owns the GameObjectFactory
13+
// this.displayList - a reference to the Display List the Scene owns
14+
// this.updateList - a reference to the Update List the Scene owns
15+
816
var Factory = new Class({
917

1018
initialize:
@@ -16,6 +24,10 @@ var Factory = new Class({
1624
this.scene = world.scene;
1725

1826
this.sys = world.scene.sys;
27+
28+
// this.displayList = this.sys.
29+
// this.displayList = sys.displayList;
30+
// this.updateList = sys.updateList;
1931
},
2032

2133
collider: function (object1, object2, collideCallback, processCallback, callbackContext)
@@ -76,12 +88,12 @@ var Factory = new Class({
7688

7789
staticGroup: function (children, config)
7890
{
79-
return new StaticPhysicsGroup(this.world, this.world.scene, children, config);
91+
return this.sys.updateList.add(new StaticPhysicsGroup(this.world, this.world.scene, children, config));
8092
},
8193

8294
group: function (children, config)
8395
{
84-
return new PhysicsGroup(this.world, this.world.scene, children, config);
96+
return this.sys.updateList.add(new PhysicsGroup(this.world, this.world.scene, children, config));
8597
}
8698

8799
});

v3/src/physics/arcade/PhysicsGroup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var PhysicsGroup = new Class({
2828

2929
config.createCallback = this.createCallback;
3030
config.removeCallback = this.removeCallback;
31-
config.classType = ArcadeSprite;
31+
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
3232

3333
this.physicsType = CONST.DYNAMIC_BODY;
3434

0 commit comments

Comments
 (0)