How do i fix my virtual camera rotation problem?


We have used the Vive stabilization blueprint structure from this article:

It works great, but we have run into the problem that when the rotation yaw changes from 180 to -180 degrees, that the camera rotates in the opposite direction to reach the destination. This happens whenever we hit that point at 180 where it goes from positive to negative and vice versa.

So we are curious if anyone has a smart idea how to pinpoint the moment it changes and/or how to fix this problem. Because of the way that the sampling for the stabilization works, it needs to be a solution that takes into consideration that the system rotates the camera to the average position of the last and current position of the virtual camera.

Edit: Have made a small video showing the problem:

The problem happens when the Z rotation hits 180 and -180 and switch over.

It’s a ‘feature’ of the engine.

You can get rid of it totally using quarternions:

Or ( because this is not actually gimbal lock ), you should find it works if you always sample the current camera yaw and only add to it ( subtract from it ).

IE, don’t make assumptions about the camera position, set it relatively.

Thank you so much, this worked. Ended up using your suggestion of separating the yaw, and the adding and subtracting from it. We might explore the quarternion solution at a later point as we have time to dive more into the solutions, but from a practical point of view, this allows us to continue on since it works.

Great :slight_smile: