How To: Object Collision with Room Scale Locomotion in 4.11

Yeah, so when you use “GetActorLocation()” on a target actor, you’re getting the very center of that actor. For a character, this point is generally right at the hip level. This may change depending on the type of character you have though, so a horse would have a very different center position from a humanoid.

If you’re controlling a character within VR, you want to view that character from its head position, not its hip position or center position. This usually means you’ll have a vector which contains an offset / displacement value from the characters center position. So, for a humanoid which is standing, this would usually just be a vector with a Z value. For a horse, it could also have X/Y displacement values. For a crawling type of creature, likewise.

So, what you’re going to be doing is matching the HMD position to the characters head position. When a person moves their head position in the play area, you want to move the controlled actors head to that same position by offsetting the body. For example, let’s say I have a humanoid character which stands at 180cm. If the character is going to be standing on top of the position [0,0,0] in world space and you ask for “get actor location”, you’ll get [0,0,90]. For the sake of simplicity, let’s pretend that the player is also 180 cm. If the player is standing in the center of their room and you ask for the HMD position, you’ll get [0,0,~180]. Now, if you just set the controlled character location to the players HMD position, you’d be placing the hips of the character at the player eye position. So if your vector displacement for the character is [0,0,90], you would get the player HMD position and subtract this displacement value to get [0,0,90] and set the actor location to this value. Now, the players eye height and the characters eye height match.

I’m currently revising my design / code for this to update for 4.13, so the original post may be outdated.