Hello,
just trying to get my c++ scripts compatible with UE 5.4 (original was 4.272)
and now compiling shows probable incomatibility with certain libraries i use:
"XRMotionControllerBase.h"
and "HeadMountedDisplayFunctionLibrary.h"
- cannot be included any longer. Does anybody now the correct include path or if these libraries were replaced by some other ?
Basically i just wanted to set the Tracking Origin to Floor
UHeadMountedDisplayFunctionLibrary::SetTrackingOrigin(EHMDTrackingOrigin::Floor);
and some minor other stuff…
that seems to be the case
The tracking origin is now based from the OpenXR plugin and can be set in Blueprint (did not find it c++).
But the new character class is such, that its capsule component is not moving with the VRplayer movements in real space. This might be solved by https://forums.unrealengine.com/t/collision-capsule-not-following-vr-movement/1467324.
I am still wondering - if there is a better solution this…
just to continue this topic, now that i understood the problem i run into better:
The VR template in unreal derives from pawn class, that does not have a capsule component nor uses the built in “character movement component”. It is though possible to switch the parent class to character, by which the character movement component (and a capsule component) is added.
This can be found in various tutorials about “Enhanced Movement inputs” - and seemed to be a good idea to use the character movement component.
But this comes with a component hierarchy, where the capsule component is root (and parent of camera). When the VR player is moving in real world - a relative location offset to the parent is added to the camera component. In other words: the capsule component is of course not moving with the camera. Which i assumed was somehow solved by the named depricated classes - but now i am not so sure about it any more
changing the hierarchy - root in the characterclass (decoupling cam and capsule component parenting) - can with some extra function solve it: update relative location change for capsule component. But… the character movement component is somehow hard-wired to the capsule component, and leads in case of decoupling the parenting to the camera to: capsule component runs without the camera. Now one might come up with some sneaky update call for the camera relative location - but in a way this is just adding unnecessary location corrections that need to run with tick - at least as long a button for movement is pressed.
To solve this, although it pains:
- only use the pawn class for your VR character
- write your own movement component → or input to walk functionality and apply any change in location and rotation directly to the root component.
- correct for the relative location offset by player movement in real world for the components the other components that are not parented to the camera.
A small note, why this is needed: if you want a rigged body you do not want this to be a child to the camera by certain reasons in the rigging.