8Observer8 Posted January 24, 2017 Share Posted January 24, 2017 Hello Help me to scale Suzanne: https://jsfiddle.net/8Observer8/sLcafhj8/ <canvas id="renderCanvas"></canvas> <script src="https://cdnjs.cloudflare.com/ajax/libs/babylonjs/2.5.0/babylon.js"></script> html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden } #renderCanvas { width: 100%; height: 100%; touch-action: none; } var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas); var scene = new BABYLON.Scene(engine); //Adding a light var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene); //Adding an Arc Rotate Camera var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 100, BABYLON.Vector3.Zero(), scene); camera.attachControl(canvas, false); var assetsManager = new BABYLON.AssetsManager(scene); var meshTask = assetsManager.addMeshTask("suzanne task", "", "https://dl.dropboxusercontent.com/s/ui1ktbggn6ky4zx/", "Suzanne.babylon"); meshTask.onSuccess = function (task) { var suzanne = loadedMeshes[0]; suzanne.position = BABYLON.Vector3.Zero(); //suzanne.scaling = new BABYLON.Vector3(15, 15, 15); suzanne.scaling.x = 15; suzanne.scaling.y = 15; suzanne.scaling.z = 15; } assetsManager.onFinish = function (tasks) { engine.runRenderLoop(function () { scene.render(); }); }; assetsManager.load(); // Move the light with the camera scene.registerBeforeRender(function () { light.position = camera.position; }); window.addEventListener("resize", function() { engine.resize(); }); Quote Link to comment Share on other sites More sharing options...
Kesshi Posted January 24, 2017 Share Posted January 24, 2017 you have to write "var suzanne = task.loadedMeshes[0];" instead of "var suzanne = loadedMeshes[0];" 8Observer8 1 Quote Link to comment Share on other sites More sharing options...
8Observer8 Posted January 24, 2017 Author Share Posted January 24, 2017 Thank you very much! Quote Link to comment Share on other sites More sharing options...
8Observer8 Posted February 3, 2017 Author Share Posted February 3, 2017 This is the correct result: https://jsfiddle.net/8Observer8/sLcafhj8/2/ 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.