Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hello there. I were attempting to write a new "zoom" behavior for camera node on my scene. Not really experienced with JavaScript (familiar with basics only) so I couldn't figure out how to extend "Zoom camera by mouse wheel" extension by adding LMB dragging support, nor how to write the whole "zoom" logic myself. Can anyone point out some guides or articles regarding the development of camera zoom? |
||||
|
I wish I could make my camera zoomable using mouse wheel, and be able to drag its position using LMB yet keeping its original coordinates when resetting |
||||
|
@Puskanie golubey, can you describe in more detail or by an existing example for what type of game (scene) you want to use the cam mechanics you wish for, please in CopperCube a camera has two components to consider: cam node position and cam target position, tell us if you would need mouse dragging for a fixed target moving relatively to mouse controlled cam node position or a fixed cam pos with mouse controlled dynamic target from what I read those things should be doable, but getting an object closer into focus can be done two ways: by a moving cam getting closer to an object or by a static cam zooming in if you would favour some kind of overhead camera above a scene (like lots of strategic games use) you could control what to get into focus by mouse dragging for CopperCube x and z axis and mouse wheel for y axis or camera zoom |
||||
|
I’m not really sure what you mean in the context of drag the camera - you’ll need to explain in a bit more detail what you’re talking about. As for zooming, though, here’s a simple snippet for zooming the camera using the mouse wheel:
|
||||
|
What I mean by "dragging" is when zoom is applied, user should be able to move the camera by X and Y using LMB, up to the limits set before. Let's say we are dealing with a gallery of images, and we have to add feature to let user look deeper into the image. Hope that clarifies. |
||||
|
This still doesn’t make it clear where the camera is supposed to move or how it ties into the zoom. You could have it jump to the 3D projection of the 2D mouse coordinates on click, but honestly, I’m still not sure what you’re actually trying to pull off. |
||||
|
|