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);
}
}