cancel
Showing results for 
Search instead for 
Did you mean: 

Adjusting the game for different body sizes

Tembac
Level 3
Hi Everyone,
I wanted to know about player heights. We are developing games for Vr and we are looking at what is the best way to match players' height. For example, someone with a small body size should be able to reach the same things ingame as someone taller.
We think this is important for competitive games where an adult can compete with a Kid.

Do you have any advice or example to do this correctly? 
2 REPLIES 2

SanCity
Level 4

@Tembac Did you solve it in a good way? I'm trying to achieve this with Open XR and getting the height by just getting the main cameras height from the "floor" (y: 0). But when starting the app, it will return 0. So I guess it takes a couple of frames before the camera is set to the correct height. So would need an event to lissen to or something to get the current height instead.


Example implementation:
https://www.youtube.com/watch?v=WAVa_9ilIEQ&t=201s

SanCity
Level 4

EDIT: Sorry, this doesnt work. Will adjust your scale for each frame 😂.

After digging though the TrackedPoseDriver class, I saw they used the InputSystem.onAfterUpdate event. So run the Resize function in the example above (getting the localPosition.y from the camera, and divide why a default height to get a scale value to apply to the CameraOffset or XR rig GameObject) when this event was triggered instead, and it seems to work. Will need some more testing to confirm everything works fine.

private void OnEnable()
{
InputSystem.onAfterUpdate += InputSystemOnonAfterUpdate;
}
private void OnDisable()
{
InputSystem.onAfterUpdate -= InputSystemOnonAfterUpdate;
}

private void InputSystemOnonAfterUpdate()
{
Resize();
}