Download

How to prevent the player from exiting the Scene Root / leaving his avatar

Hey Community,

I am working on a regular movement system with the use of the thumbsticks. And I am quite successful… Movement is working like in Onward, where the left stick applies forward/backward movement and strafing and the right thumbstick is for turning around.

The problem is that every movement and turning input is applied to the “character movement component”. What that means is that every command is applied to the origin of the player’s character blueprint. If the player does move away from this origin in the real world with his HMD, he is actually leaving the capsule component and every rotation is like being a probe in a centrifuge.

The only solution that I can imagine would be to make the HMD the parent of everything, but the character class does not allow to change the root component (the capsule component).

Do you have advice for me? I am kind of surprised that no one else experienced that problem. But maybe I was searching for the wrong keywords.

Hmm… after ages of testing different stuff, I discovered only one way to go:

(0.) Reset the HMD position after pulling it over your head once

  1. Disabling the “Lock to Hmd” option of the Camera
  2. And use the HMD position information to move the whole actor instead of just the camera (actual HMD position minus the HMD position of the last frame equals the vector that has to be applied to the actor/scene root)
  3. Apply the same math but reversed to the motion controllers
  4. Apply the HMD rotation to the camera directly, but add the actor rotation on top of it

I wrote a more in-depth explanation of that solution on my own blog page. In case someone is interested: Road to FullbodyIK suited for VR – Manuel Ott

My plugin in my signature has two separate Characters overridden for full VR support, one of them (the SimpleVRCharacter) essentially does exactly what you did, except I override the base classes so that late updates and component features aren’t lost. You can reference them if you know c++.