Sansar need commands so you can easy convert from Quaternion (yuck) to degree and the other direction. Right now things are very difficult. Because nothing works in degree. Including the object properties.

A few extra commands that do the conversion in one line between Quaternion and degree would be good.

Or it need better documentation with easy simple examples.

• Galen

It sounds like you mean you want to convert a rotation in three dimensions into an angle in one dimension. Which isn't directly meaningful.

But let's say you add a mental constraint and mean rotation in the horizontal plane, for example. Then here are some simple conversions:

`float AngleInDegrees = SomeQuat.GetEulerAngles().Z * Mathf.DegreesPerRadian;Quaternion NewQuat = Quaternion.FromEulerAngles(0, 0, AngleInDegrees * Mathf.RadiansPerDegree);`

Or did you want something else?

"I fought the quaternions and the ... quaternions won. I fought the quaternions and the ... quaternions won." Keep singing it. ;-)

Edited by Galen
• Richardus Raymaker

I think that can do it. So there's at least something i can compare with. Now try to rotate smooth with comparing angles so i know where to stop. It worked good in one direction. But it's wonky in the other direction. And i really blame somewhere the quaternions. So mabye i rebuild it so it works with degree's then i have a more solid ground to debug.

But i first frustrating try to see why it fail with quaternions. Debugging sansar code is hard  without a normal realtime log

• Richardus Raymaker

Thanks Galen. I used your example. (Math is not my strongest thing.) I converted my program so it compares in degree's instead of quat. and that made things work already 50% better. There's still a strange thing. But i do mabye something wrong. I can now at least look and compare better.

Now i wish that object properties used degree to.

• Galen

Here is a suggestion for you. Establish a baseline orientation for your object. if you must, store a simple angle representing your rotation. Then find your current orientation by multiplying the baseline orientation by a quaternion representing your angle. Here's an (untested) example:

`Vector BaseOrientation;float CurrentAngle = 0;float RotationStep = 10; // Degreesvoid SingleStep() {    // Compute what the current rotation angle is now    CurrentAngle += RotationStep;    while (CurrentAngle < 0)   CurrentAngle += 360;    while (CurrentAngle > 360) CurrentAngle -= 360;    // New orientation is base orientation rotated by the     // current angle    Quaternion NewOrientation =        BaseOrientation *        Quaternion.FromEulerAngles(            0, 0, CurrentAngle * Mathf.RadiansPerDegree        );    Body.SetOrientation(NewOrientation);}`

Edited by Galen
• Galen

@Richardus: BTW, when you see orientation values in the properties editor for objects, they are in degrees. Ordinate values typically range from -180 to +180.