Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
mattgraham's avatar
mattgraham
Honored Guest
11 years ago

Zooming in

I am using 0.4.3 and was originally trying to zoom in using FOV of the left/right cameras. I have since changed the implementation to translating the whole OVRCameraRig.

Here is the current line of code I am using to move the camera: ovrRig.transform.Translate(new Vector3(0, 0 , 0.1f));

This translation will occur while a key is held down. I would like to stop it at a specific Z valuie, lets say 2.0.

Does anyone know how to access the current coordinates of the OVRCameraRig?

3 Replies

Replies have been turned off for this discussion
  • I am making a simple project where I am just rotating an object and be able to zoom in/out (along the z-axis in 0.2f increments per update). Wrapping the OVRCameraRig in a GameObject and then using the function mentioned above seems to do the trick.

    I just need to set bounds on the zooming. This is where I need to get the camera position, so I can make sure it hasn't moved past that boundary.
  • "mattgraham" wrote:
    I am making a simple project where I am just rotating an object and be able to zoom in/out (along the z-axis in 0.2f increments per update). Wrapping the OVRCameraRig in a GameObject and then using the function mentioned above seems to do the trick.

    I just need to set bounds on the zooming. This is where I need to get the camera position, so I can make sure it hasn't moved past that boundary.

    I think you are looking for the localPosition property. This will give the position of a transform relative to it's parent.