Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality. If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers. And always feel free to hit us up on Twitter @MxdRealityDev.

How do I move the camera in Unity?

I have a scene in which I want the user's perspective to move to different locations within a scene. How do I go about doing that? Whenever I use the following code, the user's perspective doesn't change, however it appears as though the camera (Tagged as MainCamera) moves because the cursor prefab moves to where I expect it to be.

_camera.transform.localPosition = Vector3.Lerp(_camera.transform.localPosition, spawnPosition, Time.deltaTime * 6f);
_camera.transform.rotation = Quaternion.Lerp(_camera.transform.rotation, spawnRotation, Time.deltaTime *

Tagged:

Best Answer

Answers

  • I may have found my answer here: http://docs.unity3d.com/Manual/VROverview.html

    Understanding the camera
    •The camera transform is overridden with the head-tracked pose.
    •If you want to move the camera, you must attach it as a child to another game object and then move the root game object.

  • Jarrod1937Jarrod1937 ✭✭✭

    Yep, in the case of AR, the users head is the camera, so it wouldn't make sense to try and override the camera position. Since the Hololens world is the augmented with the real world, I am not sure how you'd achieve changing the users perspective by code. Basically, the user is in control of the view.

  • @Jarrod1937 said:
    Yep, in the case of AR, the users head is the camera, so it wouldn't make sense to try and override the camera position.

    I think I get what @CrazyTegger is doing - if you're doing city planning, architectural visualization, strategy gaming, etc., basically any large-scale visualization - you probably want the layout to move relative to the viewer rather than requiring a gymnasium size room to work in... And you can either move everything else in the scene around, or just move the camera about by putting it under a parent.

  • @EddieOffermann That's exactly it.

  • Or we can move everything else and keep the Main camera fixed. I am currently working on an archi/viz presentation that starts with an overview of a major metro area. It looks like an architectural city model. The plan is to zoom down to 'city hall' and view the hologram from a more detailed perspective. From above, I can put my Main camera in a parent gameobject and 'move' that or, I can lerp the position scale and rotation of my hologram to appear like the user has 'moved.' Will it make them sick.....? not sure yet. The plan is to move very slowly. Any thoughts?

  • Thank @CrazyTegger and @EddieOffermann I apply this for the case of camera flying around the earth like ISS.

Sign In or Register to comment.