Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Sern_Of_Canada's avatar
Sern_Of_Canada
Honored Guest
6 years ago

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. 

2 Replies

Replies have been turned off for this discussion
  • track the Y axis of the head anchor. If the Y value goes below your threshold value, crouch = true