Upper Body Solving. GnomeVR
Scaling Player to in-game character
To enable different players to control the same in-game character, no matter of the differences in their height/arm lengths, the Motion Controller Transforms must be scaled (up or down) to match the size of the player to the in-game character.
The goal of this scaling process is to match the transforms of the motion controllers to the in-game character. The figure below show the positions of the three tracked points before scaling relative to the size of the in-game character and after applying the scaling.
One way of achieving this is to offer an in-game player scaling setup stage.
The Demo VR game does this by asking the player to go to T-Pose, and press a certain button combination on the motion controller at game start. This assumes that the reference pose for your in-game character is a T-Pose. Once this is done, the distance between the two controllers is measured, and a scaling factor to match this distance to the in-game character is calculated. The blueprint nodes below show how this is performed.
The below blueprint nodes do the following:
- Get the position of the in-game character left and right hand in Actor space.
- Get the position of the left and right motion controllers in Actor space.
- Calculate and set a new scale for the VROrigin node as follow:
- Calculate the difference between character left and right hand positions
- Calculate the difference between player (Motion Controller) left and right hand positions
- Find the ratio between the two hand to hand distances
- Set the scale of the VROrigin node to the new scale factor
Following these steps, we ensure that any size player can drive the same in-game character even with the different body proportions.
Most VR systems track the position and rotation of 3 points (rigid bodies). These are the HMD and the two motion controllers. This limited number of control points allow us to track and control upper body movement.
To ensure that the body is not floating, the Demo VR game pins the Hips and feet to the reference pose transform and are not driven through the motion controller. Any motion that involving translating the hips (crouching, walking) will mot behave correctly in the Demo VR game.
The IKinema rig is set up in a similar way to a normal foot placement rig. i.e. it includes hips, knees and feet tasks. However, the upper body tasks are created with a special type.
- Head is of type HMD task
- Hand tasks are of type Motion Controller tasks.
When setting up the head and hand tasks, a motion controller mesh for the hand, or an HMD mesh for the head would appear. These meshes need to be positioned and rotated as if the in-game character is using them. In a similar manner to the picture above.
Another difference to the foot placement rig setup is in the tuning of the upper body joints. For example, the shoulders, upper and lower arms and the Spines. IKinema has a number of predefined settings that can be applied by
- Right click on the bone in the Hierarchy window
- Select the pre-set from the Menu that appears.
In the figure below for example, the “Spine2” bone was selected, and the Spine pre-set should be applied.
Similar pre-sets are available for the Shoulder, Upper and lower arms.
Some VR applications might require the ability to have the Hips moving freely and not being constrained to the reference pose. This can be achieved by reducing the influence of the hips task (weights) from the default 100, to a very low value of 10, or disable the task completely.