Jump to content

<orthogonal projection>camera


EricHunag
 Share

Recommended Posts

Hi, 

 

try this one:

 

var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 500, 1), scene);
camera.mode = BABYLON.Camera.ORTHOGRAPHIC_CAMERA;
camera.orthoTop = 500;
camera.orthoBottom = -500;
camera.orthoLeft = -500;
camera.orthoRight = 500;
var ratio = window.innerWidth / window.innerHeight ;
var zoom = camera.orthoTop;
var newWidth = zoom * ratio;
camera.orthoLeft = -Math.abs(newWidth);
camera.orthoRight = newWidth;
camera.orthoBottom = -Math.abs(zoom);
camera.setTarget(new BABYLON.Vector3.Zero());
scene.activeCamera = camera;

 

 

Link to comment
Share on other sites

Hello, 

 

You can use a freecamera and set an orthographic mode :

var mm = new BABYLON.FreeCamera("minimap", new BABYLON.Vector3(0,100,0), this.game.scene);mm.setTarget(new BABYLON.Vector3(0.1,0.1,0.1));// Activate the orthographic projectionmm.mode = BABYLON.Camera.ORTHOGRAPHIC_CAMERA;//These values are required for using an orthographic mode,// and represents the coordinates of the square containing all the camera view.// this.size is the size of our arenamm.orthoLeft = -this.size/2;mm.orthoRight = this.size/2;mm.orthoTop =  this.size/2;mm.orthoBottom = -this.size/2;
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...