Jump to content

setting Ortho properties more than once


JCPalmer
 Share

Recommended Posts

If orthoTop, orthoBottom, orthoLeft, orthoRight are set, things are sized as I expected.  I now want to change these, but nothing happens.  Tried calling camera._updateCache(), but that makes everything disappear, presumably because it is now too small to be seen.  Directly setting the cache values very poor results as well.

 

I can probably ditch the camera and get a new one.  Sounds a little brutal though.

Link to comment
Share on other sites

Hi, 

 

It works for me with an arc rotate camera. Maybe this piece of code (ts) can help you : update on mouseWheel event  :

private mouseWheelEvent(event): void {              var delta: number = 0;        var zoom: number = 0;        if (event.wheelDelta) {            delta = -event.wheelDelta / 40;        } else if (event.detail) {            delta = event.detail;        }        zoom = this.camera.orthoTop + delta;        if (zoom < 1) zoom = 1;        this.camera.orthoTop = zoom;        //  compute left, right & bottom        this.upateOrthographic();    }    private upateOrthographic(): void {        var ratio: number = window.innerWidth / window.innerHeight;        var zoom: number = this.camera.orthoTop;        var newWidth: number = zoom * ratio;        this.camera.orthoLeft = -Math.abs(newWidth);        this.camera.orthoRight = newWidth;        this.camera.orthoBottom = -Math.abs(zoom);    }
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...