- This topic has 4 replies, 2 voices, and was last updated 1 year, 5 months ago by aerin.
-
AuthorPosts
-
2023-07-20 at 10:50 am #65349aerinParticipant
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?
2023-07-20 at 1:23 pm #65350kdvParticipantIs 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.
2023-07-20 at 2:21 pm #65353aerinParticipantThank 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.
2023-07-20 at 2:36 pm #65354kdvParticipantFor 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.
2023-07-21 at 7:22 am #65366aerinParticipantI see. Thank you very much.
-
AuthorPosts
- You must be logged in to reply to this topic.