Ingo Chou Posted January 1, 2016 Share Posted January 1, 2016 Hello, How to remove animation created by BABYLON.Scene.beginAnimation(target, from, to, true) ? BABYLON.Animatable object returned by BABYLON.Scene.beginAnimation() can only stop at a key frame. if (bAnim) { var anim = new BABYLON.Animation("myAnimation", "scaling.x", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); var keys = []; keys.push({ frame: 0, value: 1 }); keys.push({ frame: 20, value: 0.2 }); keys.push({ frame: 60, value: 1 }); anim.setKeys(keys); mymesh.animations.push(anim); scene.beginAnimation(mymesh, 0, 60, true); } else { scene.stopAnimation(mymesh); mymesh.animations = new Array(); } Quote Link to comment Share on other sites More sharing options...
Ingo Chou Posted January 1, 2016 Author Share Posted January 1, 2016 Thanks for your reply and help. Quote Link to comment Share on other sites More sharing options...
Ingo Chou Posted January 3, 2016 Author Share Posted January 3, 2016 Hello, Can anyone help me? Thanks. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 4, 2016 Share Posted January 4, 2016 Hello, beginAnimation returns an Animatable which has a stop() function Quote Link to comment Share on other sites More sharing options...
Ingo Chou Posted January 6, 2016 Author Share Posted January 6, 2016 Hello, Thanks for your reply. Animatable.stop() can only stop the animation at a certain key frame. However, I want to delete, completely destroy/remove the animations of the mesh. Sometimes I need to re-create a new animation for it. Thanks. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 6, 2016 Share Posted January 6, 2016 I am getting into AnimationRange instances for skeletons coming from external sources, .babylon file. Was planning on adding a modest # of methods for AnimationRange management today (hopefully). At Animation Class:getHighestFrame() : number, for adding more animation ranges along with the frames themselves without frame # collision removeAnimationRange(rangeName: string) : booleanAt Bone Class:copyAnimationRange(donor : Bone, rescaleAsRequired = false) : boolean // rescaleAsRequired not implemented first PRAt Skeleton Class:copyAnimationRange(donor : Skeleton, rescaleAsRequired = false) : boolean // rescaleAsRequired not implemented first PR removeAnimationRange(rangeName : string): booleanThis is in addition to methods to load ranges. These will not be coming out of the Blender exporter yet, but tested by hand modifying a .babylon. If you start assigning ranges to stuff as you add it, then you should be able to rely on these to clean up. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 6, 2016 Share Posted January 6, 2016 Update: There is already a deleteRange method in Animation, so cross off one for me. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 6, 2016 Share Posted January 6, 2016 Update # 2: deleteRange() only removes the range from the _ranges property. Am going to add a removeFrames? : boolean arg. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 6, 2016 Share Posted January 6, 2016 sounds good! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.