- Home /
VR Player enters trigger won't work
So. I'm a student working on a VR game. I imported Steam VR and the VR interaction from the asset store. In the game the player needs to put his hand on a handscanner which triggers some 'handscan' animations (which are planes) that I animated in Unity. Now I found this youtube tutorial: https://www.youtube.com/watch?v=iKWJBgFCDWU
This tutorial uses a bool, a trigger and a script that opens his door when he enters the trigger. I thought I would give it a try on one of my planes I animated. No matter what I do, It won't work. The animation just remains in the empty state, and moving into the trigger in VR (with your body or hands) won't set off the actual animation. I followed every step of the tutorial thouroughly.
Here's a screenshot of my one animated plane selected that I tried this tutorial on. https://imgur.com/a/RcdjkU3
And the animator setup: https://imgur.com/a/bRUPFs1
This is the script:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class BlauwRandjeScript : MonoBehaviour {
private Animator _animator;
// Start is called before the first frame update
void Start()
{
_animator = GetComponent<Animator>();
}
void OnTriggerEnter(Collider other)
{
if(other.tag == "Player")
_animator.SetBool("PlayAnimation", true);
}
}
For starters I applied this whole method to one of my animated planes, just to see if it works.. I tried putting the trigger on a separate object (cube). I tried upgrading to a newer unity version, I tried a different render pipeline, I tried 3 different VR player controllers.. I even tried setting the Player tag to the hands instead of the body, or prefab itself. I'm running out of ideas.. Hope you can help me!