Search the Community
Showing results for tags 'toBeta'.
-
I would like to animate my camera from current position to another pre-determined position. Mattx264 posted the following function in 2014 According to Mattx264 function, how does the script know where the end position is located? Does toAlpha, toBeta, toRadius recieve a number? If not, how does the code know where the end value of these parameters are? Can anyone demonstrate this code in the playground? I dont understand how the end position of the radius, alpha, and beta are located in the script. There is no variables declared about them. Thanks, ah BEST ANSWER mattx264, 23 April 2014 - 04:20 AM Thank you @Deltakosh. I wrote this function, may be it will help somebody. var ArcAnimation = function (toAlpha, toBeta, toRadius,position) { var animCamAlpha = new BABYLON.Animation("animCam", "alpha", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); var keysAlpha = []; keysAlpha.push({ frame: 0, value: camera.alpha }); keysAlpha.push({ frame: 100, value: toAlpha }); var animCamBeta = new BABYLON.Animation("animCam", "beta", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); var keysBeta = []; keysBeta.push({ frame: 0, value: camera.beta }); keysBeta.push({ frame: 100, value: toBeta }); var animCamRadius = new BABYLON.Animation("animCam", "radius", 30, BABYLON.Animation.ANIMATIONTYPE_FLOAT, BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE); var keysRadius = []; keysRadius.push({ frame: 0, value: camera.radius }); keysRadius.push({ frame: 100, value: toRadius }); animCamAlpha.setKeys(keysAlpha); animCamBeta.setKeys(keysBeta); animCamRadius.setKeys(keysRadius); camera.animations.push(animCamAlpha); camera.animations.push(animCamBeta); camera.animations.push(animCamRadius); scene.beginAnimation(camera, 0, 100, false, 1, function () { }); }GO TO THE FULL POST