saygidagerek Posted February 12, 2021 Share Posted February 12, 2021 Hi everyone, Help me Pls about Babylonjs animation. I have a file with babylon extension. I want this file to move as animation only in X and Z positions. BABYLON.SceneLoader.ImportMesh( "", "/assets/", "file.babylon", scene, function (meshes) { meshes[0].position.x = -123; meshes[0].position.y = 0; meshes[0].position.z = -21; meshes[0].scaling.scaleInPlace(10); const frameRate = 10; const xSlide = new BABYLON.Animation("xSlide", "position.x", frameRate, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT); const keyFrames = []; keyFrames.push({ frame: 10, value: 120 }); keyFrames.push({ frame: frameRate, value: -160 }); keyFrames.push({ frame: 10 * frameRate, value: 112 }); xSlide.setKeys(keyFrames); meshes[0].animations.push(xSlide); scene.beginAnimation(meshes[0], 0, 3 * frameRate, true); }); 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.