File tree Expand file tree Collapse file tree
v3/src/gameobjects/sprite3d Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,20 +20,34 @@ var Sprite3D = new Class({
2020
2121 this . size = new Vector2 ( 1 , 1 ) ;
2222
23+ this . adjustScaleX = true ;
24+ this . adjustScaleY = true ;
25+
2326 this . _visible = true ;
2427 } ,
2528
2629 project : function ( camera )
2730 {
31+ var pos = this . position ;
2832 var gameObject = this . gameObject ;
2933
30- camera . project ( this . position , gameObject ) ;
34+ camera . project ( pos , gameObject ) ;
35+
36+ var scale = camera . getPointSize ( pos , this . size ) ;
3137
32- var scale = camera . getPointSize ( this . position , this . size ) ;
38+ if ( this . adjustScaleX )
39+ {
40+ gameObject . scaleX = scale . x ;
41+ }
42+
43+ if ( this . adjustScaleY )
44+ {
45+ gameObject . scaleY = scale . y ;
46+ }
3347
34- gameObject . setScale ( scale . x , scale . y ) . setDepth ( gameObject . z ) ;
48+ gameObject . setDepth ( gameObject . z ) ;
3549
36- gameObject . setVisible ( ( this . position . z > camera . z ) ) ;
50+ gameObject . setVisible ( ( pos . z > camera . z ) ) ;
3751 } ,
3852
3953 visible : {
You can’t perform that action at this time.
0 commit comments