I’m using OpenXR with C++. I made movements by using joystick of my controllers. But the movements follow the axes of my coordinate system. I would like to make the user to move in the direction of his gaze for the forward direction. I already compute transition matrix with the pose from my layer view to get the orientation of the headset. However, when the user is pushing the joystick, he is turning around himself. Do you have any suggetsion to solve my problem ?
Thanks a lot !
You’ll probably want to locate the VIEW reference space. If you treat the joystick as a vector in view space, then transform it by the view in your world space (probably based on local or stage), you’ll get motion relative to the user’s view.
According to the documention :
VIEW space is primarily useful when projecting from the user’s perspective into another space to obtain a targeting ray, or when rendering small head-locked content such as a reticle. Content rendered in
VIEW space will stay at a fixed point on head-mounted displays and may be uncomfortable to view if too large. To obtain the ideal view and projection transforms to use each frame for rendering world content, applications should call xrLocateViews instead of using this space.
So I’m trying to use pose from XrView that I got with xrLocateViews. Maybe it’s a wrong way. According to you, is it better to use the view reference space ?
I just tried to use a matrix from a pose got by view space using xrLocateSpace. It doesn’t work, my user is turning around himself.
If you’re trying to translate (slide) and you’re rotating (turning), you’ve got bigger problems with your matrix math than which coordinate system you’re representing a joystick vector in.
I don’t see where is the problem because my matrix seem to be correct. In fact, the goal of my work is to add a VR mode in a an app that wasn’t designed for it. The app has a 3D scene that use a particuliar coordinates system . We are also using a Transform object that we made ourselve. We developped tools to convert OpenXR matrix and pose to our transform object and it works well. The movements that I got when I pushed the joystick are right. But the movements follow the axes of my coordinate system. That’s why I don’t see where is the problem.