Search the Community
Showing results for tags 'manually loop'.
-
Hi guys ... I am creating transitions and blend trees for BabylonJS toolkit... The very nature of the transition system in unity DOES NOT ALLOW traditional looping... EVERYTHING is a transition condition check... if NO conditions are meet after ANY animation is play it is stopped... the have various of way they id to LOOP back on itself with ANOTHER transition set state.... So basically they ALWAYS play one iteration of an animation and check it transition condition (which may be itself) and plays that animation clip... Now I am wonder what the performance impact of babylonJS of doing ANOTHER scene.beginAnimation in the OnAnimationEnd end event in the same frame as the on animationEnd Event (so its not choppy) VS playing it with a loop cycle... I won't know if cam to loop back onto itself until AFTER the animation has been played and its conditions are check... So I gotta 'Manually Loop Animations' even small few frame animations: Yo @Deltakosh ... Pinging you in too Here is an example of some of my state machine update logic, tell me why you think the impact performance of manually looping animations this way will be: private setCurrentMachineState(name:string):void { if (this._state == null || this._state.name !== name) { this._state = this.getMachineStateInfo(name); } if (this._state != null) { this._state.interupted = false; this._state.sts = BABYLON.MachineStatus.None; if (this._state.motion != null && this._state.motion !== "" && this._state.type === BABYLON.MotionType.Clip) { var local:BABYLON.MachineState = this._state; var blend:number = BABYLON.Constants.NoBlending; var speed:number = local.speed; local.sts = BABYLON.MachineStatus.Playing; this._animataions = this.manager.playAnimationClip(local.motion, this.owned, false, speed, blend, true, ()=>{ local.sts = BABYLON.MachineStatus.Finished; this.updateStateMachine(); }); } } } NOTE: this.manager.playAnimationClip basically calls scene.beginAnimation on all required components as well... then on this.updateStateMachine will cause the component to call this.setCurrentMachineState on WHATEVER the first transition CHECK says... including it might be itself again... Hope I explained that good enough