#can i prevent camera to go through model?

5 messages · Page 1 of 1 (latest)

forest shoal
#

i have my orbitcontrols on, i would like to be able to allow zoom but without going through the model. is there any way to "detect" model and collide with it, or should i just find the sweet spot and do it manually?
thanks

ruby bluff
#

you can do that if, instead of default "zooming" in (which actually moves the camera closer), you decrease camera fov

velvet juniper
#

You can also use a raycast and stop the camera if it hits something.

marble haven
#

If it's an object which doesn't change size then find a constant minimal distance. Otherwise you might update minimal distance every frame to appriopriate number

forest shoal
#

fixed with min and maxdistance