Get size of object when window is resized

Recommended Posts


Is there a way to get the size of an object after the window has been resized? (Whole scene gets scaled down/up).


but it only displays 1.25 no matter how much I resize my browser window

Share this post

Link to post
Share on other sites

Hello, this is correct as the size is expressed in world unit and not screen space

But you can take every vectors of your bounding box and use BABYLON.Vector3.Project to get the screen projected coordinates:

var vect = BABYLON.Vector3.Project(position, BABYLON.Matrix.Identity(), scene.getTransformMatrix(), camera.viewport.toGlobal(engine));

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.