@@ -28,6 +28,7 @@ export class Actuator {
28
28
lastUpdateTime : number = 0 ;
29
29
averageUpdateInterval : number = 0.200 ;
30
30
moving : boolean = false ;
31
+ turning : boolean = false ;
31
32
32
33
stateSystemController : StateSystemController ;
33
34
movementState : MovementState ;
@@ -86,6 +87,7 @@ export class Actuator {
86
87
this . lastPosition . z = this . springTwo . currentPosition . z ;
87
88
88
89
this . moving = true ;
90
+ this . turning = true ;
89
91
this . entity . dispatchEvent ( new CustomEvent ( Events . EVENT_STATE_BEGIN , { detail : new EntityStateEventDetail ( "moving" ) } ) ) ;
90
92
console . log ( this . entity . tagName + ":" + "start moving" ) ;
91
93
@@ -148,7 +150,7 @@ export class Actuator {
148
150
}
149
151
150
152
simulate ( t : number ) {
151
- if ( this . moving ) {
153
+ if ( this . moving || this . turning ) {
152
154
this . lastPosition . x = this . springTwo . currentPosition . x ;
153
155
this . lastPosition . y = this . springTwo . currentPosition . y ;
154
156
this . lastPosition . z = this . springTwo . currentPosition . z ;
@@ -212,7 +214,8 @@ export class Actuator {
212
214
//console.log(orientationDelta);
213
215
214
216
//const orientationDelta = ((this.springOne.targetOrientation) as any).angleTo(this.springTwo.currentOrientation) as number;
215
- const moving = positionDelta > 0.1 || orientationDelta > 0.2 ;
217
+ const moving = positionDelta > 0.1 ;
218
+ const turning = orientationDelta > 0.2 ;
216
219
//console.log(positionDelta);
217
220
218
221
if ( ! this . moving && moving ) {
@@ -224,6 +227,7 @@ export class Actuator {
224
227
console . log ( this . entity . tagName + ":" + "end moving" ) ;
225
228
}
226
229
this . moving = moving ;
230
+ this . turning = turning ;
227
231
}
228
232
229
233
}
0 commit comments