8Observer8 Posted September 22, 2016 Share Posted September 22, 2016 Sorry for my stupid question but I don't know why the Camera doesn't rotate around my textured cube: https://8observer8.github.io/BabylonJS/TexturedCube/ function main() { // Retrieve the canvas element var canvas = document.getElementById("renderCanvas"); if (canvas == null) { console.log("Failed to retrieve the canvas element"); return; } var engine = new BABYLON.Engine(canvas, true); var createScene = function () { BABYLON.SceneLoader.Load("", "TexturedCube.babylon", engine, function (scene) { // Wait for textures and shaders to be ready scene.executeWhenReady(function () { // Create a light var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(0, 5, -10), scene); //light.groundColor = new BABYLON.Color3(0.2, 0, 0.3); // Create Arc Rotate Camera var camera = new BABYLON.ArcRotateCamera("Camera", 0, Math.PI / 2, 12, BABYLON.Vector3.Zero(), scene); camera.attachControl(canvas, false); //console.log(scene.mesh[0]); // Once the scene is loaded, just register a renger loop to render it engine.runRenderLoop(function () { scene.render(); }); // Resize window.addEventListener("resize", function () { engine.resize(); }); }); }, function (progress) { // ToDo: give progress feedback to user }); return scene; }; var scene = createScene(); } Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 22, 2016 Share Posted September 22, 2016 Hello it is far simpler for us to help you if you can create a playground repro. In the meantime, can you confirm that your cube is centered at (0, 0, 0) ? Quote Link to comment Share on other sites More sharing options...
8Observer8 Posted September 22, 2016 Author Share Posted September 22, 2016 10 minutes ago, Deltakosh said: it is far simpler for us to help you if you can create a playground repro. I tryed but I cannot to upload .png file on the playgound. How to do this? 10 minutes ago, Deltakosh said: can you confirm that your cube is centered at (0, 0, 0) ? Yes, I can write to console by: console.log(scene.meshes[0].position); Quote i x:0 y:0 z:0 Quote Link to comment Share on other sites More sharing options...
8Observer8 Posted September 22, 2016 Author Share Posted September 22, 2016 I know what I did. I will create a playgound exampe with texture object, but I will use texture from playground texture folder Quote Link to comment Share on other sites More sharing options...
gryff Posted September 22, 2016 Share Posted September 22, 2016 Is the file you used for the "Texturedcube.babylon" the one I looked at above? And when you exported it, did you export the camera? If so, open that TexturedCube.babylon in a text editor and look to see if it has made that camera the "active camera". If it has, then add this line of code to your code: scene.activeCamera = camera; after the line that creates the camera, but before the line that attaches the camera to the canvas. cheers, gryff Quote Link to comment Share on other sites More sharing options...
8Observer8 Posted September 22, 2016 Author Share Posted September 22, 2016 4 hours ago, gryff said: Is the file you used for the "Texturedcube.babylon" the one I looked at above? And when you exported it, did you export the camera? Yes Thank you very much: https://8observer8.github.io/BabylonJS/TexturedCube/ 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.