- Home /
Photon IK sync
Hello im trying to sync my IK i have attached this script to the player and active it when spawned but it dosent sync rotation so it dosent look up and down, i have tried everything even put a photon view on the look position transform but it dident work either, so can somebody be nice take a look at my script ? please help me with my first online game.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class IKHandling : Photon.MonoBehaviour
{
Animator anim;
public float lookIKweight;
public float bodyWeight;
public float headWeight;
public float eyesWeight;
public float clampWeight;
public Transform lookPos;
void Start()
{
anim = GetComponent();
if (photonView.isMine)
{
lookPos = new GameObject().transform;
lookPos.name = "Look_Position";
lookPos.transform.parent = this.transform;
}
}
void Update()
{
Ray ray = new Ray(Camera.main.transform.position, Camera.main.transform.forward);
Debug.DrawRay(Camera.main.transform.position, Camera.main.transform.forward * 15);
lookPos.position = ray.GetPoint(15);
}
void OnAnimatorIK(int layerIndex)
{
anim.SetLookAtWeight(lookIKweight, bodyWeight, headWeight, eyesWeight, clampWeight);
anim.SetLookAtPosition(lookPos.position);
}
}
Answer by Carterryan1990 · Jul 26, 2018 at 09:29 PM
Hi did you ever solve your issue? I'm currently experiencing the same issue. I cannot get the ik positions to sync. would be awesome if you found a solution that you could share.
Your answer
Follow this Question
Related Questions
Unity multiplayer solutions: Photon, Unity Networking - what else and in what way is good? 0 Answers
PUN - Choose random Hero for player 0 Answers
How can I instantiate different prefabs for owner and proxy using photon? 2 Answers
If my game uses Photon Multiplayer, can my users host their own game? 1 Answer
Photon Networking: RPC call doesn't work over other clients 0 Answers