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

Moving the [CameraRig]

Discussion in 'AR/VR (XR) Discussion' started by TheHeavySoldier, Oct 30, 2016.

  1. TheHeavySoldier

    TheHeavySoldier

    Joined:
    Oct 20, 2016
    Posts:
    7
    Hey everyone,

    I finally got my player movement working properly, using the touchpads. But now I can't seem to change the position of the [CameraRig].
    Currently I'm trying to update it's position to match the players position.

    My player movement:

    Emtpy GameObject, attached a Rigidbody, Capsule Collider and my PlayerMovement script to it.

    I move this GameObject using the touchpad on the controller, and I rotate it by making the GameObject match my controller's Y rotation.

    If I parent the [CameraRig] to it, the camera will rotate because I rotate my controller so that's not an option. If changing the [CameraRig]'s transform.position is not an option I guess I'll have to make the [CameraRig] a child of my PlayerController and figure out another solution for the rotation. Although I feel I'll probably won't figure that out because this took me long enough (I'm not exactly an experienced game developer / programmer).

    If anyone could help me out.
     
  2. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    What if you Create a new empty GO and parent the "player" and camera rig to that, and when you move, you move the root GO? Rotation should then only affect the inner "player".?
     
  3. TheHeavySoldier

    TheHeavySoldier

    Joined:
    Oct 20, 2016
    Posts:
    7
    Hey man, I didn't realize that the HeadCamera object inside the CameraRig object had the MainCamera tag attached to it as well.

    So I ended up with [CameraRig] and head both having the same tag and my FindWithTag referenced to the head instead of to the CameraRig.

    I ended up creating another unique tag for the CameraRig and searched for that and it worked.
    Silly mistake.
     
  4. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Ohh, good you solved it : D
     
  5. mariamnour

    mariamnour

    Joined:
    Mar 16, 2018
    Posts:
    1

    Could you please share your movement code, I have the same problem and I couldn't solve it yet.
     
    ROBYER1 likes this.