Quaternion problem

Hi, excited to start looking at Stride for the first time after finding out Distant Worlds 2 will be using the engine.

to cut my teeth, I’m looking to create a simple “god cam” I know there is already a default movecontroller, but I wanted to have a go at making my own.

I have positioning working fine, but rotation seems to be a real pain in the neck. ( would be great for a tutorial about some of this as it differs from Unity in being far move complex, helper functions would be great!)

I have a simple line of code:

Entity.Transform.Rotation *= Quaternion.Multiply(Quaternion.RotationY(-Input.MouseDelta.X * CameraRotationSpeed),Quaternion.RotationZ(Input.MouseDelta.Y * (this.invertLook?-CameraRotationSpeed:CameraRotationSpeed)));

When I move the mouse it the rotation stays as expected. However, if I move to 90 degrees around the Y axis ( move mouse to the left or right until the “orb” on the first app it to the left or the right) The RotationZ rotates around WorldZ not localZ, so my horizon basically rolls.

Can anyone assist in explaining how I would translate this to work on the Local? ( assuming thats what my issue is)

Thanks in advance.

How do you know Distant Worlds 2 is using Stride Engine?

Which engine does DW2 use?
It’s a significantly customized version of Xenko/Stride.

from: DW2 FAQ/QnA megathread - Ask your question here!