Mezzorio Posted August 15, 2017 Share Posted August 15, 2017 Hello! I am looking at around 40 sprites which are actually being replaced with HD Images, I was wandering if there are ways to animate or any alternative solution as i'm struggling to find a solution to the lag and drop in frames currently which makes it look bad, I will insert a playground here with my current working version, but the main issue being the playground doesn't lag as it won't be loading my images and the size and scale of my images is far higher than the can't load texture issue. Secondarily, if anyone could tell me how to add a small amount of movement to look up and down but I want to prevent the camera looking more than 10/20 degrees above or below the mid point to keep it focused. https://www.babylonjs-playground.com/#AEXWGL#1 The example mouse movement camera rotation and general project i'm using as inspiration can be found here: https://www.g-star.com/en_gb/raw Quote Link to comment Share on other sites More sharing options...
Zuzuk Posted August 15, 2017 Share Posted August 15, 2017 Function that can control camera angle is in Height_Map tutorial: var camerasBorderFunction = function () { //Angle if (camera.beta < 0.1) camera.beta = 0.1; else if (camera.beta > (Math.PI / 2) * 0.9) camera.beta = (Math.PI / 2) * 0.9; //Zoom if (camera.radius > 150) camera.radius = 150; if (camera.radius < 30) camera.radius = 30; }; scene.registerBeforeRender(camerasBorderFunction); Quote Link to comment Share on other sites More sharing options...
Mezzorio Posted August 15, 2017 Author Share Posted August 15, 2017 1 hour ago, Zuzuk said: Function that can control camera angle is in Height_Map tutorial: var camerasBorderFunction = function () { //Angle if (camera.beta < 0.1) camera.beta = 0.1; else if (camera.beta > (Math.PI / 2) * 0.9) camera.beta = (Math.PI / 2) * 0.9; //Zoom if (camera.radius > 150) camera.radius = 150; if (camera.radius < 30) camera.radius = 30; }; scene.registerBeforeRender(camerasBorderFunction); Could you possibly demonstrate on my playground as I cannot work out how to use these and actually get them to work or make any difference, as currently I have them implemented without any change to my project Quote Link to comment Share on other sites More sharing options...
Zuzuk Posted August 16, 2017 Share Posted August 16, 2017 16 hours ago, Mezzorio said: Could you possibly demonstrate on my playground as I cannot work out how to use these and actually get them to work or make any difference, as currently I have them implemented without any change to my project It's on line 292: https://www.babylonjs-playground.com/#AEXWGL#4 function in tutorial for arcRotateCamera, for freeCamera you need to use camera.rotation.x instead of camera.beta Quote Link to comment Share on other sites More sharing options...
Mezzorio Posted August 16, 2017 Author Share Posted August 16, 2017 3 hours ago, Zuzuk said: It's on line 292: https://www.babylonjs-playground.com/#AEXWGL#4 function in tutorial for arcRotateCamera, for freeCamera you need to use camera.rotation.x instead of camera.beta Thanks all working now! 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.