Comments (9)
@Jesusbill dolly to cursor isn't as useful for orthographic cameras
from camera-controls.
@yomotsu I think he might be asking about zooming in on the mouse pointer, which is what I'm also here to ask about.
Is there any way to get the camera to zoom (and translate) about the mouse pointer on mousewheel, rather than about the center of the screen?
A bit like how Google Maps' zoom works.
Great camera, by the way.
from camera-controls.
See here. I personally prefer using dolly too!
https://github.com/yomotsu/camera-controls#dolly-vs-zoom
from camera-controls.
So, I've got the following code, which I've run the numbers on and it will work, however for some reason the camera moves in a very unpredictable way when I add this to zoomInternal
var zoomTowards = {
x: _this._camera.left + (x / window.innerWidth) * (_this._camera.right - _this._camera.left),
y: _this._camera.top + (y / window.innerHeight) * (_this._camera.bottom - _this._camera.top)
};
var center = {
x: _this._camera.left + (_this._camera.right - _this._camera.left) / 2,
y: _this._camera.top + (_this._camera.bottom - _this._camera.top) / 2
};
var position = new THREE.Vector3(
center.x + ((zoomTowards.x - center.x) * zoomScale),
center.y + ((zoomTowards.y - center.y) * zoomScale),
0
);
this.moveTo(position.x, position.y, this._camera.position.z);
Am I doing something wrong here in terms of interacting with your code @yomotsu ?
Thank you again for your time in this :)
from camera-controls.
I'll take a look
from camera-controls.
Closing this issue.
Zoom-to-cursor for orthographic has been implemented:
https://yomotsu.github.io/camera-controls/examples/orthographic.html
from camera-controls.
Hi liuyehua,
Sorry, I don't get your point. Could you explain that in more detail, please?
from camera-controls.
I see, thanks!
I started working on it at #103
dollyToCursor
feature is already available tho
from camera-controls.
@yomotsu what is the difference between dolly and zoom? I already use dollyToCursor
to zoom to mouse cursor.
from camera-controls.
Related Issues (20)
- problem HOT 1
- Bug with setting interactiveArea top position. HOT 1
- Dolly behavior in first person mode is different when scrolling up and down HOT 1
- How to use CameraControls in react native HOT 2
- camera-controls does not export its types HOT 7
- Lerping min/max zoom set on Orthographic Camera HOT 1
- moveTo function in orthographic mode has inconsistent behaviour on mobile devices/ipad HOT 1
- Best coding pattern for onresize? HOT 1
- Pointer lock behaviour different ? HOT 1
- Speed up setLookAt or lerpLookAt HOT 5
- Invalid "main" entry in v2.8.x HOT 10
- Add focus function HOT 7
- Error 'ThreeCameraControls.install is not a function' HOT 2
- Method to cancel ongoing transitions HOT 5
- Mouse wheel zoom doesn't work with pressed Shift on Mac HOT 1
- The automated release is failing π¨ HOT 1
- Update three.js version to 162 HOT 2
- Not update in worker HOT 5
- Dolly to Cursor and focalOffset HOT 4
- I want to replace camera-controls with the default controls in my project, here is an example, how can I do it to be compatible correctly? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camera-controls.