Syncing controller held objects using VRTK

I have VRTK and Photon working well in a Unity project but when a player picks up an item using 'child of grab attach' the networked object becomes a child of the local SteamVR rig, specifically the right or left controller object, when this happens the Transform View information is no longer correct for the other players in the scene (position for example goes to 0, 0, 0) until the object is dropped again.

Does anybody have any pointers or a solution on how to best remedy this?

Perhaps by changing the parent of the grabbed object in the scene for the observing players temporarily to the networked avatar hand of the player doing the grabbing?

Comments

  • emotitron
    emotitron ✭✭✭
    Simple Network Sync does have a bunch of handling for this that works well with VR, but SNS is in beta.

    If you would like to play with it you can get links in the Simple channel of this discord:
    https://discord.gg/egaRfd8

    OR check the links on this doc:
    https://docs.google.com/document/d/1ySmkOBsL0qJnIk7iN9lbXPlfmYTGkN7JFgKDBdqj9e8/edit

    The system SNS uses it all net entities (PhotonViews) have a state sync that syncs a parent PhotonView and Mount id. Mounted objects don't sync their transforms, they just set their parent to the Mount indicated and set position and rotation to zeros. You could do something similar yourself.

    The built in TransformView syncs aren't good for this, as they must be on the same node as the PhotonView, and they also sync transform.position/rotation rather than transform.localPosition/localRotation.

    I do have a change in for the next Pun2 release that will make the transform/animator syncs sit on children nodes - so that will make them work better for this.