We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

How to limit flying camera zoom?

Home Forums Puzzles How to limit flying camera zoom?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #65349
    aerin
    Participant

    Hello!

    Is there a way to set a zoom range to a flying camera so that the user can’t zoom into objects and zoom out infinitely?

    I couldn’t find a thread about it and there don’t seem to be such settings for the camera in the 3D software, so I decided to ask here.

    Some additional context: I’m using Blender; the project has a room and the player moves by clicking on “hotspot” objects that tween the camera; I want the player to be able to zoom in on certain objects too look at them more closely but, of course, not zoom in too far and go into them.

    Also the zooming steps are a bit to big (one scroll zooms too much), is there a way to control that?

    #65350
    kdv
    Participant

    Is there a way to set a zoom range to a flying camera so that the user can’t zoom into objects and zoom out infinitely?

    In fact it’s not zooming. When you use the mouse wheel or press W/S keys you do the same thing: you move the scene’s camera forward/backward. The same action but with different speed. Actually, the real zooming is used only with an orthographic camera. That’s the only case. In all other cases you change the scene’s camera position. That’s why the camera can fly through objects when zoomed in too close.

    I want the player to be able to zoom in on certain objects too look at them more closely but, of course, not zoom in too far and go into them.

    If you don’t use keys to move camera you can disable zooming this way

    and then use this puzzle for zooming
    https://www.soft8soft.com/docs/manual/en/puzzles/Camera.html#zoom_camera_to_object
    Or you will need to write some script to change the scene’s camera actual zoom value with the mouse wheel.

    Also the zooming steps are a bit to big (one scroll zooms too much), is there a way to control that?

    You can tweek the mouse wheel “zooming” speed this way

    The default value for the Flying camera is 75. Too fast. Set it to 15-30. 15 is the default value for the First Person camera. It’s an optimal value.

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #65353
    aerin
    Participant

    Thank you very much for the reply!

    Both of this scripts work and they can be enough of a fix, but is it possible to limit the zoom in a similar way (instead of disabling it)? For example, with minZoom and maxZoom or something? I want the user to be able to zoom in, for example, on a document in the scene, so they can see what is written from closer.

    #65354
    kdv
    Participant

    For example, with minZoom and maxZoom or something?

    Custom controls via JS only. With puzzles you can’t control app.camera.zoom value.

    But you can use constraints for the scene camera limiting its position.

    For example, after tweening move the special empty object to the scene camera’s position and add a constraint to limit the distance from this object.

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #65366
    aerin
    Participant

    I see. Thank you very much.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.