Home  »  Code • Guides • Libraries • Programming • Snippets • Technology   »   Babylon.js Camera Position Example Code

Babylon.js Camera Position Example Code

Posted: January 2, 2023 | by Michael Bright

Parameters: name, position, scene.

var camera = new BABYLON.UniversalCamera("UniversalCamera", new BABYLON.Vector3(0, 0, -10), scene);

Targets the camera to a particular position. In this case the scene origin.

camera.setTarget(BABYLON.Vector3.Zero());

Attach the camera to the canvas.

camera.attachControl(canvas, true);

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.