File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ var Camera3D = new Class({
166166 children [ i ] . position . transformMat4 ( mat4 ) ;
167167 }
168168
169- return this . update ( ) ;
169+ return this . updateChildren ( ) ;
170170 } ,
171171
172172 /**
Original file line number Diff line number Diff line change @@ -25,12 +25,25 @@ var Sprite3D = new Class({
2525 this . adjustScaleX = true ;
2626 this . adjustScaleY = true ;
2727
28+ this . fastHide = true ;
29+
2830 this . _visible = true ;
2931 } ,
3032
33+ // Performs a simple check to see if this Sprite3D object should be hidden from view if its
34+ // z position is behind the cameras. Very fast but doesn't take camera direction into consideration,
35+ // so not suitable for all types of game.
36+ setFastHide : function ( value )
37+ {
38+ this . fastHide = value ;
39+
40+ return this ;
41+ } ,
42+
3143 project : function ( camera )
3244 {
3345 var pos = this . position ;
46+
3447 var gameObject = this . gameObject ;
3548
3649 camera . project ( pos , gameObject ) ;
@@ -48,6 +61,11 @@ var Sprite3D = new Class({
4861 }
4962
5063 gameObject . setDepth ( gameObject . z ) ;
64+
65+ if ( this . fastHide )
66+ {
67+ gameObject . setVisible ( pos . z > camera . position . z ) ;
68+ }
5169 } ,
5270
5371 visible : {
You can’t perform that action at this time.
0 commit comments