Jump to content

Mezzorio
 Share

Recommended Posts

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

Link to comment
Share on other sites

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);

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...