Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Has anyone implemented an XR Rig / Input System w/ PUN2? How do you isolate transforms?

Discussion in 'XR Interaction Toolkit and Input' started by johnfbest, Nov 19, 2021.

  1. johnfbest

    johnfbest

    Joined:
    Jun 27, 2018
    Posts:
    3
    Hi forum,

    I'm a little stuck with something that should be simple using Unity's Input System with an XR Rig and PUN2. I can instantiate the players fine, I cannot figure out how to disconnect the player transform updates between players.

    I've attempted using the "photonView.IsMine" wrappers to both stop calculations and also to enable / disable components, but so far I have not been able to pinpoint the functions and/or components that need to be wrapped to make this work.

    End result should be position and rotation of head and controllers update only the local player and you can see that player's transform changes by every other player in the PUN2 room.

    My XR Rig GameObject has the following:
    Player (XR Rig)
    - Camera Offset
    - - Main Camera
    - - - Capsule
    - Locomotion System
    - XR Interaction Manager
    - LeftHand Controller
    - RightHand Controller

    Components on Player (XR Rig)
    - XR Rig
    - Input Action Manager
    - Character Controller
    - Character Controller Driver
    - Photon View
    - Photon Transform View Classic
    - Player Controller (my script that I'm using to test how to isolate movement to only local player)


    Thanks for any insights!
     
  2. unitydreamer29

    unitydreamer29

    Joined:
    Dec 27, 2020
    Posts:
    47
    Hey there, not sure if I'm grasping your problem exactly, are you saying that the local player movements are being tied to remote player movements as well?

    If so ->

    When other players spawn into your scene (remote instances), make sure all XR related scripts are disabled on that remote player: XRRig, move provider scripts, main camera, character controller, etc should all be disabled. You can then rely on photon transform views to sync everything.

    I use VRIK which comes with a PUN2 script to sync the head and hands, which works well but it can take a while to dial all the settings in.
     
  3. Deleted User

    Deleted User

    Guest

    You could check out Valems mini series to get some advice on this:
     
  4. falsevaccume

    falsevaccume

    Joined:
    Jun 8, 2022
    Posts:
    3
    This tutorial is based on device based XR, he himself wrote the custom script to map inputs from XR, I am using XR toolkit with action based rig I didn't wrote such script that's why I don't know where should I put this condition (PhotonView.IsMine)
     
  5. kmilo9999

    kmilo9999

    Joined:
    Oct 20, 2016
    Posts:
    3
    I know it's been a while. Did you manage to workaround this issue? If so, please let me know.