Inverse Kinetics Is Not Working

I'm developing a multiplayer app for both the Oculus Rift and Quest using Unity, PUN 2 (Photon View, Photon Animator View, etc.), and the VRIK feature of Final IK (from the Unity Asset Store). In terms of humanoid model avatar motions following the player's hand and head motions, for the Rift everything works fine except that the other player's avatar is in its default state (in my case with the arms elevated and extended away from the body) and completely motionless.

For the Quest everything's fine for the first player until the second player enters the room, at which point the hands of both players' avatars lock up and can't be moved.

Any insight as to how to resolve these issues will be greatly appreciated.

Answers

  • I am wondering whether Photon Animator View can be used in this case. I think it can only be used to sync the animation state.

    I am using OnPhotonSerializeView to sync bone rotation after getting the IK result.

  • Thanks for posting, fengkan. Could you provide some example code as how you're using OnPhotonSerializeView?
  • fengkan
    fengkan
    edited November 2019
    It's something like:


    OnPhotonSerializeView
    if (stream.IsWriting)
    {
    for (int i = 0; i < bonesToUse.Length; i++)
    {
    stream.SendNext(Joints[i].rotation);
    }
    }
    else
    {
    isReceiving = true;
    for (int i = 0; i < bonesToUse.Length; i++)
    {
    targetRotations[i] = (Quaternion)stream.ReceiveNext();
    }
    }


    Update
    if (isReceiving)
    {
    for (int i = 0; i < targetRotations.Count; i++)
    {
    Joints[i].rotation = targetRotations[i];
    }
    }


    btw, I think you can also sync the position of your VR controllers and do the IK instead of syncing IK result.
  • Thanks, I'll try out your suggestions! So when you say, "btw, I think you can also sync the position of your VR controllers and do the IK instead of syncing IK result" do you mean sync the VR controllers using OnPhotonSerializeView (or RPC)?
  • Hi, never mind, glad to help.

    I think there are two ways to do the sync.

    1. do IK first, and sync the result rotations.
    you will need OnPhotonSerializeView (or RPC) to do that.

    2. sync the position of controllers, and HMD of course, and do IK on each client separately.
    You can use photon transform view to sync the transform of the controllers.

    If you have further questions, don't mind asking.
  • Thank you, fengkan. I'll try the approaches you recommend, although I have to admit my coding skills are somewhat limited. If you would like to contact me directly, my address is qodj-15[at]yahoo.com. It would be nice to get to know you outside the forum.