# Opengl accumulte delta eulers >180 from result quaternion

## Recommended Posts

I'm trying to understand how maya, blender, unity etc get new eulers in widget while user rotate model in local coordinate system by gizmo in viewport.
This applications somehow save rotate in eulers but perform operation in quaternions. I can't understand how they save/convert quaternion to eulers and get eulers more than 180 degree
If i simplest convert result quaternion to eulers i can't get result like in applications above. I can't get angle more 180

Unity for example

This is my code explain my attemps to do that.

Quaternion rotation; //relative (local rotation)
Vector3 eulersRotation;
Quaternion parentRotation;
//it is psevdo code where we calculate delta angle that user generate on current frame by mouse
void SetDeltaWorldRotationFromUserInput(Quaternion value)
{
SetWorldRotation(value);
}

void SetWorldRotation(Quaternion value)
{
SetLocalRotation(parentQuaternion.inverted() * value); //set local rotation
}

void SetLocalRotation(Quaternion value)
{
rotation = value; // we save new local rotation but i want to save somehow more then 180 degree
auto eulersForGui = value.toEulers(); //it is current eulers but i want to accumulate and show in gui accumulate rotation. like currentRotation + delta or somehow

auto deltaEulers = (value * rotation.inverted()).toEulers(); //i can get delta eulers but i can't add it to       euelers and don't know what i need to do with this value
eulersRotation += deltaEulers; //it is similar wrong. I don't know how to do it correctly
}

## Create an account

Register a new account

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 13
• 9
• 25
• 18
• ### Forum Statistics

• Total Topics
634438
• Total Posts
3017450
×