@@ -5,6 +5,14 @@ var CONST = require('./const');
55var PhysicsGroup = require ( './PhysicsGroup' ) ;
66var 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+
816var 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} ) ;
0 commit comments