Jump to content

Get camera view


Hersir
 Share

Recommended Posts

Hi,

have a question, is it possible to get coordinates in 3d space of arcRotatinCamera (width, height and leftTop corner vector) of visible area ?

I need to zoom on area and than move out all not needed objects out of camera view and align mesh to topRight corner of visible area

Link to comment
Share on other sites

@Wingnut Thanks will check that, tried to go a bit different way but also stuck there :D

const v = Vector3.Unproject(
            new Vector3(0 ,0 , 0),
            viewport.width,
            viewport.height,
            Matrix.Identity(),
            cam.getViewMatrix(true),
            cam.getProjectionMatrix(true),
);

Tried to convert 2d 0,0 point to 3d in camera to get left corner but it didn't worked out well,  just got centre point

Link to comment
Share on other sites

for now did this

const leftTop = this.getScene().pick(0, 0, undefined, false, cam).pickedPoint;
const leftBottom = this.getScene().pick(0, viewport.height, undefined, false, cam).pickedPoint;
const rightTop = this.getScene().pick(viewport.width, 0, undefined, false, cam).pickedPoint;
const rightBottom = this.getScene().pick(viewport.width, 0, undefined, false, cam).pickedPoint;

 

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...