public override void receivePositionList3D(SimplePositionList3D position3dList) { lock (thisLock) { m_data = UbiMeasurementUtils.ubitrackToUnity(position3dList); } }
// Use this for initialization public override void utInit(Ubitrack.SimpleFacade simpleFacade) { base.utInit(simpleFacade); switch (ubitrackEvent) { case UbitrackEventType.Pull: { m_position3DListPull = simpleFacade.getPullSinkPosition3DList(patternID); m_simplePosition3DList = new SimplePositionList3D(); if (m_position3DListPull == null) { throw new Exception("SimpleApplicationPositionList3DReceiver not found for patternID:" + patternID); } break; } case UbitrackEventType.Push: { m_listReceiver = new Unity3DListReceiver(); if (!simpleFacade.set3DPositionListCallback(patternID, m_listReceiver)) { throw new Exception("Simple3DListReceiver could not be set for patternID:" + patternID); } break; } default: break; } }
// Use this for initialization public override void utInit(SimpleFacade simpleFacade) { base.utInit(simpleFacade); switch (ubitrackEvent) { case UbitrackEventType.Pull: { m_position3DListPull = simpleFacade.getPullSinkPosition3DList(patternID); m_simplePosition3DList = new SimplePositionList3D(); if (m_position3DListPull == null) { throw new Exception("SimpleApplicationPositionList3DReceiver not found for patternID:" + patternID); } break; } case UbitrackEventType.Push: { m_listReceiver = new Unity3DListReceiver(); if (!simpleFacade.set3DPositionListCallback(patternID, m_listReceiver)) { throw new Exception("Simple3DListReceiver could not be set for patternID:" + patternID); } break; } default: break; } }
public override void receivePositionList3D(SimplePositionList3D position3dList) { lock (thisLock) { m_data = UbiMeasurementUtils.ubitrackToUnity(position3dList); } }
public void sendData() { SimplePositionList3D ubi3DList = new SimplePositionList3D(); ubi3DList.timestamp = UbiMeasurementUtils.getUbitrackTimeStamp(); SimplePosition3DValue_Vector list = new SimplePosition3DValue_Vector(ListPoints.Length); for (int i = 0; i < ListPoints.Length; i++) { Vector3 ubiPos = new Vector3(); UbiMeasurementUtils.coordsysemChange(ListPoints[i].position, ref ubiPos); SimplePosition3DValue value = new SimplePosition3DValue(); value.x = ubiPos.x; value.y = ubiPos.y; value.z = ubiPos.z; list.Add(value); } ubi3DList.values = list; m_listReceiver.receivePositionList3D(ubi3DList); }
internal static Measurement <List <Vector3> > ubitrackToUnity(SimplePositionList3D position3dList) { List <Vector3> data = new List <Vector3>(); Vector3 tmp = new Vector3(); foreach (SimplePosition3DValue entry in position3dList.values) { tmp.x = (float)entry.x; tmp.y = (float)entry.y; tmp.z = (float)entry.z; Vector3 output = new Vector3(); tmp = tmp * UbiToUnityScaleFactor; coordsysemChange(tmp, ref output); data.Add(output); } return(new Measurement <List <Vector3> >(data, position3dList.timestamp)); }
internal static Measurement<List<Vector3>> ubitrackToUnity(SimplePositionList3D position3dList) { List<Vector3> data = new List<Vector3>(); Vector3 tmp = new Vector3(); foreach (SimplePosition3DValue entry in position3dList.values) { tmp.x = (float)entry.x; tmp.y = (float)entry.y; tmp.z = (float)entry.z; Vector3 output = new Vector3(); coordsysemChange(tmp, ref output); data.Add(output); } return new Measurement<List<Vector3>>(data, position3dList.timestamp); }