File tree Expand file tree Collapse file tree
plugins/spine/src/gameobject Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ var ComponentsTransform = require('../../../../src/gameobjects/components/Transf
1515var ComponentsVisible = require ( '../../../../src/gameobjects/components/Visible' ) ;
1616var GameObject = require ( '../../../../src/gameobjects/GameObject' ) ;
1717var SpineGameObjectRender = require ( './SpineGameObjectRender' ) ;
18+ var CounterClockwise = require ( '../../../../src/math/angle/CounterClockwise' ) ;
19+ var RadToDeg = require ( '../../../../src/math/RadToDeg' ) ;
1820
1921/**
2022 * @classdesc
@@ -123,9 +125,34 @@ var SpineGameObject = new Class({
123125
124126 this . root = this . getRootBone ( ) ;
125127
128+ if ( this . root )
129+ {
130+ // +90 degrees to account for the difference in Spine vs. Phaser rotation
131+ this . root . rotation = RadToDeg ( CounterClockwise ( this . rotation ) ) + 90 ;
132+ }
133+
134+ this . state . apply ( skeleton ) ;
135+
136+ skeleton . updateCache ( ) ;
137+
126138 return this . updateSize ( ) ;
127139 } ,
128140
141+ refresh : function ( )
142+ {
143+ if ( this . root )
144+ {
145+ // +90 degrees to account for the difference in Spine vs. Phaser rotation
146+ this . root . rotation = RadToDeg ( CounterClockwise ( this . rotation ) ) + 90 ;
147+ }
148+
149+ this . updateSize ( ) ;
150+
151+ this . skeleton . updateCache ( ) ;
152+
153+ return this ;
154+ } ,
155+
129156 setSize : function ( width , height , offsetX , offsetY )
130157 {
131158 var skeleton = this . skeleton ;
You can’t perform that action at this time.
0 commit comments