- Home /
Keep GameObject anchored to position on zooming screen?
I'm using the Leap Motion Widgets and I'm trying to use one of the special sliders to zoom the camera. I have the slider modifying the value of Camera.fieldOfView, and it works. The problem here is that zooming in on the camera zooms in on everything (of course), including the slider widget itself.
How do I keep the widget anchored to the camera such that its position and size don't change when the camera zooms? (If it's possible.)
I need to keep the slider interactive with the Leap Motion controller + virtual hands.
Answer by Denvery · Aug 15, 2015 at 06:40 AM
Hello! I see several possible ways to solve your problem
You can change local scale or z-coordinate of your slider synchronously with changing Camera.fieldOfView. I.e. if you increase fieldOfView, the slider became smaller. So you can increase its localScale or make it closest via z-coordinate.
Use separate (orthographic) camera for slider. As a result, fieldOfView will not change your slider
Draw your slider with new or old Unity GUI
Hope my advices could help you:)
P.s. If anyone knows other solutions, it's very interesting for me!
Number 3 wasn't really an option for me because I needed it to be interactive with the virtual hand, but option 2 worked perfectly! Thank you
Your answer
Follow this Question
Related Questions
field of view slider starting point 1 Answer
Camera movement in a 2D? (like angry birds) 1 Answer
Indicate with markers the direction of Gameobjects which are outside of the camerafield. 0 Answers
Find out if GameObject is in Field of View 2 Answers
Change camera FOV to keep 3d scene same size on screen, independently from resolution 0 Answers