How do i detect if a player crouches in VR?

Im trying to detect the players headset position and see if its lower then the ingame characters head, but it doesnt work.

first calibrate a height for the player, do this by allowing them to stand up straight and pressing a button to set their height. Now store this value. We can assume that they’re crouching when they’re below a certain height from their calibrated height. I think a calculation like this could work
height.Y - calibratedHeight.Y * .5
obviously you’d need to experiment with what’s a good height.

Optionally you can get their head cframe from the floor cframe and if they’re close enough, they’re crouching

1 Like

Yes that’s a very nice way of doing it, I would also recommend doing the same for taking floor measures like asking the player to touch the floor and pressing a button due to proportion (not everyone is the same height)

1 Like

How would you get the floor cframe? Do you mean the in-game floor?

oh no I was thinking about the floor usercframe

vrservice:GetUserCFrame(Enum.UserCFrame.Floor)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.