Support sending poses from Unity changes
This commit is contained in:
parent
3cf49f649d
commit
5ef609fd12
@ -29,11 +29,18 @@ 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,
|
||||
this.twist);
|
||||
return q;
|
||||
return q;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ namespace RoboidControl.Unity {
|
||||
/// </summary>
|
||||
protected virtual void FixedUpdate() {
|
||||
UpdateThing();
|
||||
core.orientation = LinearAlgebra.SwingTwist.FromQuaternion(this.transform.localRotation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -340,6 +340,7 @@ namespace RoboidControl {
|
||||
if (_orientation != value) {
|
||||
_orientation = value;
|
||||
orientationUpdated = true;
|
||||
updateQueue.Enqueue(new CoreEvent(PoseMsg.Id));
|
||||
//OnOrientationChanged?.Invoke();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user