Squashed 'LinearAlgebra/' changes from 9b2a047..493c19c
493c19c Fix ToVector3 35b6830 Support sending poses from Unity changes 6d74649 Compatibility git-subtree-dir: LinearAlgebra git-subtree-split: 493c19cbe22465ead382a42ff952b06a24f60dda
This commit is contained in:
parent
9b2a04746d
commit
fd01740d76
@ -106,7 +106,7 @@ namespace LinearAlgebra {
|
||||
// }
|
||||
|
||||
public Vector3 ToVector3() {
|
||||
float verticalRad = (float)(Math.PI / 2 - this.direction.vertical) * Angle.Deg2Rad;
|
||||
float verticalRad = (float)(90 - this.direction.vertical) * Angle.Deg2Rad;
|
||||
float horizontalRad = this.direction.horizontal * Angle.Deg2Rad;
|
||||
float cosVertical = (float)Math.Cos(verticalRad);
|
||||
float sinVertical = (float)Math.Sin(verticalRad);
|
||||
|
@ -29,6 +29,13 @@ namespace LinearAlgebra {
|
||||
}
|
||||
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
public static SwingTwist FromQuaternion(Quaternion q) {
|
||||
// q.ToAngles(out float right, out float up, out float forward);
|
||||
UnityEngine.Vector3 angles = q.eulerAngles;
|
||||
SwingTwist r = new SwingTwist(angles.y, angles.x, angles.z);
|
||||
return r;
|
||||
}
|
||||
|
||||
public Quaternion ToQuaternion() {
|
||||
Quaternion q = Quaternion.Euler(-this.swing.vertical,
|
||||
this.swing.horizontal,
|
||||
|
@ -1,3 +1,4 @@
|
||||
#if !UNITY_5_6_OR_NEWER
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace LinearAlgebra.Test {
|
||||
@ -15,3 +16,4 @@ namespace LinearAlgebra.Test {
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user