Download

C++ HMD tracking doesn't initialize on spawn in packed build compared to editor play.

I recently created a custom VR_Playerstart actor that functions like the default unreal playerstart.

It differs in the way it chooses a player start. Where the default player start uses the location of the playerstart actor to spawn a new player, I first do an offset to the ground of that position.
Unreal then spawns the player relative to that position as it uses the center of the boundary box as it’s starting point.


I simply rotate those vectors to spawn the VR Pawn/HMD In the same exact position&rotation as the VR_Playerstart.
(My VR gamemode then searches for VR playerstarts instead of the normal ones)

This all works perfectly and smooth, except for packaged builds.

The tracking seems to be initialized later than the gamemode spawning the pawn.
If I use this within the InitGame() function of my VR_GameMode:


GEngine->XRSystem->SetHeadTrackingEnforced(true);

The tracking state of the HMD then returns true, however, both of the following functions still return a zero transform.


GEngine->XRSystem->GetCurrentPose(IXRTrackingSystem::HMDDeviceId, OrientationAsQuat, Position);


UHeadMountedDisplayFunctionLibrary::GetOrientationAndPosition(hmd_rotation, hmd_position);

Does anyone have any experience in forcing the HMD to initialize tracking or am I doing something wrong?

Thanks a lot!

Kind Regards
Jan