This code doesn’t teleport the character controller to the controllers position, instead it teleports it somewhere completely differently. I don’t understand why.
using UnityEngine;
using UnityEngine.XR.Interaction.Toolkit;
public class AntiHandNoClip : MonoBehaviour
{
public CharacterController hand;
private XRController controller;
private void Start()
{
controller = transform.parent.parent.GetComponent<XRController>();
transform.parent = null; // unparent from the controller
}
private void LateUpdate()
{
hand.Move(controller.transform.position);
}
}
The transforms aren’t messed up since this script is on the parent of the hand mesh which is just an empty game object. I seriously am so confused about why this doesn’t work. Especially because when I move the right controller the hand seems to update at a completely random time, how is that even possible?