Map world space into screen pixel units

Is there a way to grab how many pixels of screen size a mesh is taking up in terms of width and height. I want to create a circular menu that is revealed by clicking on the mesh. Each mesh can vary in size and therefore i’ll need to know the width and height of the mesh in terms of pixels.

I think the best option is to project the bounding info on the screen with Vecotr3.Project API

https://www.babylonjs-playground.com/#JFW56V#11
use 256px for have optimization
https://www.babylonjs-playground.com/#JFW56V#12

3 Likes

@nasimiasl is there a node package for the Shader builder library that is being loaded using cdn?

hi
the typescript version exist in BABYLON Extension

for use shaderBuilder you just need add
BABYLONX.ShaderBuilder.InitializeEngine();
before you use
and in this example that just make Color Uniq ID
i can change the code and write this example without shaderBuilder too if you want

code without shaderBuilder :slight_smile: my dear shader Builder always be hide :frowning:
https://www.babylonjs-playground.com/#JFW56V#21

@nasimiasl that last playground without shaderBuilder seems not to render scene.

https://www.babylonjs-playground.com/#JFW56V#21

1 Like