Tainder Posted January 21, 2014 Share Posted January 21, 2014 Hey guys ! I'd like to create a basic animation on only 1 axis. I want to move a plane from 1 place wich i already know x , y ,z to another place wich i also know x , y ,z and never stop this animation. I tried with the tutorail and swap the "scaling.x" by a position.x but this didnt work. Here is the code i discribe : var animationBox = new BABYLON.Animation("tutoPigeon","position.x",30,BABYLON.Animation.ANIMATIONTYPE_FLOAT,BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);// An array with all animation keysvar keys = []; //At the animation key 0, the value of scaling is "1" keys.push({ frame: 0, value: 1 // }); //At the animation key 20, the value of scaling is "0.2" keys.push({ frame: 20, value: 0.2 }); //At the animation key 100, the value of scaling is "1" keys.push({ frame: 100, value: 1 });animationBox.setKeys(keys);planPigeon.animations.push(animationBox); scene.beginAnimation(planPigeon, 0, 100, true); Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 22, 2014 Share Posted January 22, 2014 it should work.. What result do you get? Quote Link to comment Share on other sites More sharing options...
Tainder Posted January 22, 2014 Author Share Posted January 22, 2014 The plane moves on x axis but its not an animation just not like with the scaling option.There's other animation tool wich does the same or a solution to get à real time animation with this one ?Thanks for replies,CheersTainder Tainder 1 Quote Link to comment Share on other sites More sharing options...
Tainder Posted January 22, 2014 Author Share Posted January 22, 2014 Ok so with my previous code the result is the plane appears then after the 100 frames it disappear for like a sec and then appear again Quote Link to comment Share on other sites More sharing options...
davrous Posted January 22, 2014 Share Posted January 22, 2014 Can you please share your complete code sample on jsfiddle or similar? It should work. I'm doing the exact same thing animating position.x & y & z on the camera for instance without problem. David Quote Link to comment Share on other sites More sharing options...
Tainder Posted January 22, 2014 Author Share Posted January 22, 2014 http://jsfiddle.net/gHBs2/ At the bottom of the HTML just before the camera. Quote Link to comment Share on other sites More sharing options...
Tainder Posted January 23, 2014 Author Share Posted January 23, 2014 There the live exemple with the code I just share you : http://lajambobinette.pulseheberg.org/customShaders.html The animation is based on the plane textured by the wood in the air. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 23, 2014 Share Posted January 23, 2014 you first key is empty on your sample: keys.push({ // frame: 0, // value: 1 });You have to define a value instead the system will not be able to interpolate value Quote Link to comment Share on other sites More sharing options...
Tainder Posted January 23, 2014 Author Share Posted January 23, 2014 Ahah i'm so dumb :/ Thanks ! So if I want to make it move from the left sided box to the right sided one I just have to set like more at frame & value ? Quote Link to comment Share on other sites More sharing options...
Tainder Posted January 23, 2014 Author Share Posted January 23, 2014 Oh, i should just use this kind of animation no ? This can be way better :BABYLON.Animation.prototype.floatInterpolateFunction = function (startValue, endValue, gradient) { return startValue + (endValue - startValue) * gradient;}; Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 24, 2014 Share Posted January 24, 2014 Yes just add more frames. The floatInterpolateFunction function is already used by the animation engine 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.