/// <summary> /// Given the position of a marker from this frame, averages it with the last few registered poses /// to calculate a smoothed pose, and sets the gameObject's position/rotation to that pose. /// </summary> /// <param name="pos">World position of marker as detected this frame.</param> /// <param name="rot">World rotation of marker as detected this frame.</param> public void SetSmoothedPose(Vector3 pos, Quaternion rot) { hiddenFramesCount = 0; positionStack.Push(pos); gameObject.transform.position = GetAveragePosition(); rotationStack.Push(rot); gameObject.transform.rotation = GetAverageRotation(); }
public override void MarkerDetectedSingle(Vector3 worldposition, Quaternion worldrotation) { hiddenFramesCount = 0; gameObject.SetActive(true); //We don't check disableWhenNotSeen when applying this in case the user changes the setting at runtime. positionStack.Push(worldposition); transform.position = GetAveragePosition(); rotationStack.Push(worldrotation); transform.rotation = GetAverageRotation(); }