Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Change AR Camera Postion

Discussion in 'AR' started by jalajshah, May 1, 2020.

  1. jalajshah

    jalajshah

    Joined:
    Mar 5, 2018
    Posts:
    61
    Hello, everyone.


    I am working on AR Foundation SDK, and TrackPoseDriver is enabled on my AR Camera, I need to change AR Camera position runtime, I am able to do this using Change TrackposeDriver type to Rotation only, but once set it Rotation and position Both its returns on the last place.

    is there any way to do this?

    Actually I am trying to Teleportation functionality in the AR building walkthrough.
     
  2. sam598

    sam598

    Joined:
    Sep 21, 2014
    Posts:
    60
    The point of TrackPoseDriver is to set the virtual camera position and rotation to match a real camera position and rotation.

    If you want to create a teleportation function for a virtual environment, you should change the position of the camera's parent object by the amount you want to move the camera.
     
  3. jalajshah

    jalajshah

    Joined:
    Mar 5, 2018
    Posts:
    61
    I had tried the same but the issue is when we move in an actual environment after placing an object , A camera move according to device position but the parent stays at the same point. now if we move or teleport Parent object on some location then camera also teleport because its child so view is not same as i want in Virtual.
     
  4. jalajshah

    jalajshah

    Joined:
    Mar 5, 2018
    Posts:
    61
    I am trying to add Joystick functionality in AR Walkthrough of Building, suppose I need to teleport user 1st floor to the second floor. that is my issue.
     
  5. vanceagrig

    vanceagrig

    Joined:
    Jul 13, 2018
    Posts:
    7
    Hi, I know it is late, but someone might find it useful.
    There is no way to move the ArCamera during runtime(because of the ArPoseDriver which sets the cam pos and rotation according to the device orientation).
    But you can move the ArSessionOrigin before enabling the ArCamera gameobject.

    see this article : https://docs.unity3d.com/Packages/c...tyEngine.XR.ARFoundation.ARSessionOrigin.html

    Here is a sample of how I use it for a multi player game.

    ArSessionOrigin.transform.position = inGame.kickerCamSpawnPositions.position;
    ArSessionOrigin.transform.rotation = inGame.kickerCamSpawnPositions.rotation;
    mainCam.SetActive(true);---(maincam is the ArCamera GameObject)

    The ArCamera is set to Position(0,0,0), this way the ArSessionOrigin position will always give me the start position and rotation that I want.
     
    Last edited: Aug 31, 2022
    andyb-unity likes this.