02-06-2023 04:29 AM
Hopefully someone can point me in the right direction. I'm developing a game with Unreal 4.27. I'm using a custom movement component, and have a standard component setup. Pawn->origin component->HMD camera. I'm doing smooth movement off the sticks to move the pawn around. That's all working nicely, no surprises in the setup. I'd like to allow the player to just walk around IRL at the same time. I see that in many VR games and that's how I usually play. Currently I get a relative HMD offset per tick and apply that to the pawn to line them up. This sort of give me what I want, but I end up with a double offset. The HMD offsets to it's parent and then the pawn does the same. I'd need to set the HMD local offset back to 0 0 in XY so that everything lines back up again, but it appears that offset is controlled by the XR system and any number I set just get overridden. If I apply an opposite offset to the origin component, I sort of get what I need, but after some wall collisions etc, the HMD and pawn locations get out of sync.
Am I going about this wrong? Is there a standard way to handle this?
I've searched around quite a lot but have not found samples or docs or anything to give me a hint.
Any advice appreciated 🙂