Unity, Photon and Inverse Kinematics

Options
We are working on a VR experience using Unity, Photon Networking and the Oculus Rift.

It is a first person game, and we want the VR viewpoint to follow the avatar's head.

Motions of the Oculus headset need to be mapped onto the avatar. In particular, the direction of the avatar's gaze, and the exact position of the base of the head need to track the headset.

When running a single instance this can be done using Mecanim inverse kinematics and calls like SetLookAtPosition.

As we are using it, the PhotonAnimatorView, by itself, does not copy the head position changes to other clients. So first -- am I missing a setting in the component?

I also tried calling SetLookAtPosition from an RPC routine. Locally it works fine (because the local SetLookAtPosition is called somewhere down in the call stack below the RPC call in OnAnimatorIK). On the remote station, however, I get the error message "SetLookAtPosition should only be called from within OnAnimatorIK".

This is a fairly straight-forward use case, but I cannot figure out how to get it to work.

Any help would be appreciated.

Comments

  • BillWelden
    Options
    I've got it now.

    In the RPC routine, you just need to store the requested head position, and then when OnAnimatorIK is eventually called, use it for SetLookAtPosition. It needs an extra isMine test on the sending side (and PhotonTargets.Others when calling RPC), but all-in-all not too complicated.
  • CarterManley
    Options
    Hey I know this is a super old post but would you mind sharing your script? Im having such a hard time figuring it out.