/// <summary> /// Pushes the data of newly received marker data into the interpolation process /// </summary> /// <param name="upd"> /// An update from a single marker <see cref="OneMarkerUpdate"/> /// </param> public void UpdateMarker(OneMarkerUpdate upd) { if(time<upd.timestamp) { time=upd.timestamp; currentPosition=upd.position; currentRotation=upd.rotation; currentWeight=1.0f; } else if(time==upd.timestamp) { currentPosition=Vector3.Lerp(currentPosition,upd.position,currentWeight/(currentWeight+1.0f)); currentRotation=Quaternion.Slerp(currentRotation,upd.rotation,currentWeight/(currentWeight+1.0f)); currentWeight+=1.0f; } }
/// <summary> /// Use Start() for initialization. Overrides the inherited base method. /// </summary> public override void Start() { base.Start(); if(upd!=null) { upd=new OneMarkerUpdate(); } }
/// <summary> /// Update the given one marker update by calling the UpdateMarker method from the TransformationContainer class. /// </summary /// <param name="upd"></param> void UpdateMarker(OneMarkerUpdate upd) { if(upd != null) { transCont.UpdateMarker(upd); } }