Forum Discussion
Zylann
11 years agoHonored Guest
[Solved] Problem using the pose quaternion
Hello,
I'm having trouble getting correct rotations with my custom game engine:
When I rotate the rift left, it goes right.
When I rotate up, it goes down...
However, when I roll, the rotation is good whatever direction I'm facing.
I've seen a few posts regarding a similar issue for left-handed cases. However, instead of using euler angles or converting to a view matrix, I'm using a direct copy frop the LibOVR's Quat type to my own Quaternion type (something like myHead.setRotation(Quaternion(quat.w, quat.x, quat.y, quat.z))..
I tried to invert the quaternion, but there is still wrong rotations here and there... not sure what I should do :?
Any idea how I can fix this?
Edit: I checked the values of quaternion (w,x,y,z) when rotating an object 90° right in both my engine and Unity3D for a reference: values are the same, but LibOVR gives different ones...
I'm having trouble getting correct rotations with my custom game engine:
When I rotate the rift left, it goes right.
When I rotate up, it goes down...
However, when I roll, the rotation is good whatever direction I'm facing.
I've seen a few posts regarding a similar issue for left-handed cases. However, instead of using euler angles or converting to a view matrix, I'm using a direct copy frop the LibOVR's Quat type to my own Quaternion type (something like myHead.setRotation(Quaternion(quat.w, quat.x, quat.y, quat.z))..
I tried to invert the quaternion, but there is still wrong rotations here and there... not sure what I should do :?
Any idea how I can fix this?
Edit: I checked the values of quaternion (w,x,y,z) when rotating an object 90° right in both my engine and Unity3D for a reference: values are the same, but LibOVR gives different ones...
2 Replies
- MatlockHonored GuestI would just negate the x of the quat, and see if that fixes one of your rotations. If that works, you will also need to negate on of the remaining y, or z to fix the other rotation.
Also, you said "quaternion (w,x,y,z)" I have never seen the W component listed as the first one, it is usually (x,y,z,w). That could be a massive problem in your implementation - ZylannHonored GuestOk, after a few tests, I found that this combination gives the correct rotations:
myHead.setRotation(Quaternion(q.w, -q.x, -q.y, q.z));
The W is first because my Quaternion type has a constructor taking it as first parameter, because it's the real part. That's just an order of arguments. Maybe I should put the W last to make it less misleading.
Thank you for the advice :)
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 years ago
- 8 months ago
- 2 years ago