1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-14 04:05:41 +00:00

Convert rad<->deg where appropriate

This commit is contained in:
Oliver Booth 2022-12-05 15:21:04 +00:00
parent 8c4ed9d955
commit d40129856a
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
2 changed files with 14 additions and 1 deletions

View File

@ -1,6 +1,7 @@
using System.Numerics; using System.Numerics;
using VpSharp.Extensions; using VpSharp.Extensions;
using VpSharp.Internal; using VpSharp.Internal;
using X10D.Math;
using static VpSharp.Internal.NativeAttributes.DataAttribute; using static VpSharp.Internal.NativeAttributes.DataAttribute;
using static VpSharp.Internal.NativeAttributes.FloatAttribute; using static VpSharp.Internal.NativeAttributes.FloatAttribute;
using static VpSharp.Internal.NativeAttributes.IntegerAttribute; using static VpSharp.Internal.NativeAttributes.IntegerAttribute;
@ -167,6 +168,14 @@ public abstract class VirtualParadiseObjectBuilder
{ {
Rotation.Value.ToAxisAngle(out Vector3d axis, out angle); Rotation.Value.ToAxisAngle(out Vector3d axis, out angle);
(x, y, z) = axis; (x, y, z) = axis;
angle = angle.RadiansToDegrees();
}
if (double.IsPositiveInfinity(angle))
{
x = x.RadiansToDegrees();
y = y.RadiansToDegrees();
z = z.RadiansToDegrees();
} }
_ = vp_double_set(handle, ObjectRotationX, x); _ = vp_double_set(handle, ObjectRotationX, x);

View File

@ -5,6 +5,7 @@ using VpSharp.Entities;
using VpSharp.Exceptions; using VpSharp.Exceptions;
using VpSharp.Internal; using VpSharp.Internal;
using VpSharp.Internal.NativeAttributes; using VpSharp.Internal.NativeAttributes;
using X10D.Math;
using static VpSharp.Internal.NativeMethods; using static VpSharp.Internal.NativeMethods;
namespace VpSharp; namespace VpSharp;
@ -204,6 +205,9 @@ public sealed partial class VirtualParadiseClient
if (double.IsPositiveInfinity(angle)) if (double.IsPositiveInfinity(angle))
{ {
rotX = rotX.DegreesToRadians();
rotY = rotY.DegreesToRadians();
rotZ = rotZ.DegreesToRadians();
rotation = Quaternion.CreateFromYawPitchRoll(rotY, rotX, rotZ); rotation = Quaternion.CreateFromYawPitchRoll(rotY, rotX, rotZ);
} }
else else