Skip to content

Commit

Permalink
[Core] Fixed xyz rotations hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
wannkunstbeikor committed Sep 17, 2023
1 parent 8d2166a commit 7be5be6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions FrostyPlugin/Controls/Editors/FrostyLinearTransformEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ protected override void UpdateValues()
{
dynamic newVector = TypeLibrary.CreateObject("Vec3");

/* not needed, since we use xyz instead of ypr now?
if (X < -180.0f) X = -180.0f;
else if (X > 180.0f) X = 180.0f;
if (Y < -180.0f) Y = -180.0f;
else if (Y > 180.0f) Y = 180.0f;
if (Z < -180.0f) Z = -180.0f;
else if (Z > 180.0f) Z = 180.0f;
else if (Z > 180.0f) Z = 180.0f;*/

newVector.x = X;
newVector.y = Y;
Expand Down Expand Up @@ -139,7 +140,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
// then convert...

float val = (float)(Math.PI / 180.0);
Matrix m = Matrix.RotationYawPitchRoll(-obj.Rotation.x * val, obj.Rotation.y * val, obj.Rotation.z * val);
Matrix m = Matrix.RotationX(obj.Rotation.x * val) * Matrix.RotationY(obj.Rotation.y * val) * Matrix.RotationZ(obj.Rotation.z * val);
m = m * Matrix.Scaling(obj.Scale.x, obj.Scale.y, obj.Scale.z);

trns.trans.x = obj.Translation.x;
Expand Down

0 comments on commit 7be5be6

Please sign in to comment.