public bool GetVector(out Microsoft.DirectX.Vector3 v)
{
Snap.Magnet m1, m2;
// Ask for 1st point
if ((m1 = GetPoint(Culture.Get("getVector1"))) == null)
{
v = Microsoft.DirectX.Vector3.Empty;
return false;
}
// Activate vector Tracking
Tracking.TrackingService ts = TrackingService;
TrackingService = Tracking.VectorTrackingService.Instance;
Microsoft.DirectX.Vector3 origin = m1.SnapPositionInt;
TrackingService.SetPoint(origin);
SnapPrimaryPoint = new Canguro.Controller.Snap.PointMagnet(origin, Canguro.Controller.Snap.PointMagnetType.SimplePoint);
// Ask for 2nd point
if ((m2 = GetPoint(Culture.Get("getVector2"))) == null)
{
v = Microsoft.DirectX.Vector3.Empty;
TrackingService = ts;
return false;
}
SnapPrimaryPoint = new Canguro.Controller.Snap.PointMagnet(m2.SnapPositionInt, Canguro.Controller.Snap.PointMagnetType.SimplePoint);
// Calculate and return difference
v = m2.SnapPositionInt - origin;
Model.UnitSystem.UnitSystem us = Canguro.Model.UnitSystem.UnitSystemsManager.Instance.CurrentSystem;
v.X = us.FromInternational(v.X, Canguro.Model.UnitSystem.Units.Distance);
v.Y = us.FromInternational(v.Y, Canguro.Model.UnitSystem.Units.Distance);
v.Z = us.FromInternational(v.Z, Canguro.Model.UnitSystem.Units.Distance);
TrackingService = ts;
return true;
}