Skip to main content
New Participant
March 22, 2019

How do you set up crouch detection?

Hey everyone, I'm new to coding for vr and relatively new to Unity too. I'm trying to figure out how to implement crouch detection for a host of game functions such as stealth. I want a bool to trigger true when the player reaches a certain threshold when crouching but I am unsure what the best way of going about it is. So far I have my height in a float and a second float that is 0.6 of that number. I am not really sure where to go from here. Not sure what to track to detect how far the headset is above the ground at any given time either. 
    This topic has been closed for replies.

    2 replies

    Inspiring
    March 22, 2019
    track the Y axis of the head anchor. If the Y value goes below your threshold value, crouch = true
    New Participant
    April 1, 2019
    That should work, thank you!