JCPalmer Posted April 20, 2015 Share Posted April 20, 2015 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. Quote Link to comment Share on other sites More sharing options...
Samuel Girardin Posted April 20, 2015 Share Posted April 20, 2015 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); } JCPalmer 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted April 20, 2015 Author Share Posted April 20, 2015 Thanks, I am using a 2nd camera attached only to the scene for picking, not the canvas. The fact that you got it to work was enough for me to keep on going. I found if I call camera.getProjectionMatrix(), it causes things to work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.