Syncing Inverse Kinematics


I am currently making a first person game using Photon and I am using Inverse Kinematics when I pick up a certain item. I have both Animations on my character models as well as Inverse Kinematics. The animations are synced over the network however the Inverse Kinematics only appear locally. I am doing my logic in this function:
void OnAnimatorIK() {
        if(animator) {
            if(ikActive) {
                if (handObj != null)
                    animator.SetIKPositionWeight(AvatarIKGoal.RightHand, 1);
                    animator.SetIKRotationWeight(AvatarIKGoal.RightHand, 1);
                    animator.SetIKPosition(AvatarIKGoal.RightHand, handObj.position);
                    animator.SetIKRotation(AvatarIKGoal.RightHand, handObj.rotation);
            else {
                animator.SetIKPositionWeight(AvatarIKGoal.RightHand, 0);
                animator.SetIKRotationWeight(AvatarIKGoal.RightHand, 0);

I attempted to make the logic inside OnAnimatorIK() go into an RPC however I got plenty of warnings saying that I cannot use SetIKPosition and SetIKRotation outside of OnAnimatorIK(). So my main question is how I can update the position of the hand for all players on the network rather than just for the local player.

Thank you


Sign In or Register to comment.