Move World origin

Hi, is there a way to not have the world origin at the center of the canvas?
I’ve tried the following playground:
camera.targetScreenOffset.y = -3;

somehow that work but is not perfect. If I zoom out, the mesh goes toward the center.
The end goal is to have space above to put some UI. :thinking:

Hello! Technically on computer graphics, the world origin is always at (0,0,0), but you can move the objects and the camera to any position you want. Since the size of objects on screen depends on the camera, you’ll have to adjust the objects’ positions relative to the camera’s position to get the effect you want. I found a quick way by just shifting the sphere’s position down relative to the camera’s current radius (which corresponds to the zoom level): Sphere Examples | Babylon.js Playground (babylonjs.com)

2 Likes

Thank you, carolhmj for your answer. I forgot to mention that the project needs to be able to rotate around the target sphere without changing her position on the screen.

Oh, I see :slight_smile: In this case, you could set the camera’s target as the sphere, and modify targetScreenOffset relative to the camera’s radius so that the zoom works proper: Sphere Examples | Babylon.js Playground (babylonjs.com)

It works !