XR Interaction Toolkit: How do detect if my player is standing on a object?

19 views Asked by At

I want to be able to detect if the player is standing on a cylinder with the tag "PositionTracker". I have enabled is trigger on the cylinder and added rigidbody to it. I have the script below attached to the 'XR Origin (XR Rig)' game object but currently not seeing any output in the console. Not sure if I attached it to the correct player game object though. What did I do wrong?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class TrackPosition : MonoBehaviour
{  
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("PositionTracker")){
            Debug.Log("on the tracker");
        }
       
    }
}

0

There are 0 answers