HTC Vive: Getting the distance from the floor to the tracking origin

Is this an integrated part of ROBLOX or am I just going to have to add some arbitrary displacement and hope it’s right?

Er, can you be a little more specific? Primary lighthouse?

Edit: Oh, VR

Oh, sorry, I wasn’t very clear.
I’m talking about the Vive’s lighthouse. Your UserCFrames are all based around their distances to one of the lighthouses. This means that unless the player’s head is perfectly level with or higher than the lighthouse then they are most likely below the floor (y negative) which, given how you’re supposed to set up the Vive, is extremely likely.

1 Like

@0xBAADF00D can probably provide an answer. He’s one of the people who works on VR.

Your CFrames should be based on some arbitrary origin, the lighthouses themselves are irrelevant for game devs. This is why the room setup has you set the controllers on the floor. As of right now, the tracking space doesn’t seem to be centered on the floor. If it were, you would be able to just set your camera’s Y position to the floor’s height and it would be normal.

I think @zeuxcg would have some good insight into this. We might need to settle on a standard that works for as many cases as possible, and potentially add an API method to get some info about the user’s setup that is as headset-agnostic as possible.

By the way, there’s a subforum for this, show it some love! http://devforum.roblox.com/c/Platform-Support/vr-support I’d appreciate a reason to start checking it!

We definitely need an API call to get the distance from the tracking origin to the floor. If we don’t have that we can’t set up a VR game where the floor matches the physical floor.

What should happen if the headset doesn’t supply that info though? Should it just return 0, or should it indicate it somehow?

nil probably, that would allow you to supply your own default value

1 Like

Personally, I would prefer it throw an error as it is standard for most of the ROBLOX API to throw an error when something is not in the correct state. A method could be added to UserInputService (UserInputService:GetVRCapabilities()) to allow developers to test whether a feature is supported on a VR headset.

I’d rather not wrap every call to this API in a pcall. Nothing else in UIS will error if you ask for uninitialized data (accelerometer/gyro, gamepads, usercframe).

2 Likes

Ah, okay. In that case, it should probably return 0.

Function bool UserInputService:GamepadSupports(UserInputType gamepadNum, KeyCode gamepadKeyCode)
Could have something like UIS:VRSupports(VRFeatureType featureEnum)
(but with better names that actually sound good)

1 Like