Jump to content

Camera Zoom inverting


Brunex92
 Share

Recommended Posts

Ok then just set the camera center farther than your mesh (There is no zoom per se but a radius: when you zoom you reduce the radius)

I think that you should just set the lowerRadiusLimit to 1 or even 0.1 if you really want to go closer.

A negative radius means that you went beyond the center of the camera

Link to comment
Share on other sites

@Brunex92 what you could do, is to use arcRotate for your grid area, and when your zoom hits something like 0.1, switch to a freeCamera, (update it's position & path to same as arcRotate, pre-switching) and capture mouse scrolling, so the camera moves forward when scrolling in, and moves backwards when scrolling out and when you reach your grid area again, reset to arcRotate.

Another option could be, when zoom hits 0.1, again, capture mouse scrollng, but instead of zooming, move the arcRotate's target position in the direction you're "zooming" and when you go back again, reset. 

Link to comment
Share on other sites

@Brunex92 i'm not sure what you mean, or perhaps you misunderstood me, the idea was to have two cameras, at the grid area arcRotate is set as the active, but, you still update freeCamera's position & direction to constantly match the arcRotate, so when you switch to freeCamera nothing else really changes for the user, but you would ofc lose the rotational "benefits" which arcRotate have.

but anyhow, option two, with moving the arcRotate's target position would probably be the best choice between my two ideas, unless you're up for doing a bit of customization to engine.

It's quite a tricky issue^^

 

Link to comment
Share on other sites

@aWeirdoOh I got it now,

So for the first option is that I've never worked with two cameras in any 3D application, and the rotational benefits from arcRotate are really necessary for me
For the second option, how can i move the target position?

I don't intend to modificate the engine at all

Edited by Brunex92
misspelling
Link to comment
Share on other sites

@Brunex92 

arcRotateCamera rotates around a target, "camera.target" (Vector3, also camera.target.x  / y or z works for specific numbers ), you would need to calculate the direction you're zooming and then calculate the next position, and update the target location acordingly.

 

Link to comment
Share on other sites

@Brunex92
camera.setTarget = babylon vector3;  should do it, but it's some complicated stuff^^

I made a simple playground to show the idea of it(the move direction is fixed), http://www.babylonjs-playground.com/#KNMZ0#21

It needs a lot of work, smoothing out movement, calculating correct movement, disabling the camera's actual zoom when it shouldn't be enabled(when zoomed all the way in and moved away from grid), etc etc.. as i said, it's a complicated issue :D, many variables to think about.

good luck

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