Пример #1
0
    public override void CameraOverride(Trackable trackable, Transform camera, RecognizedTarget target, ref Vector3 position, ref Quaternion rotation, ref Vector3 scale)
    {
        var imageTarget = target as ImageTarget;

        if (imageTarget != null)
        {
            Debug.Log("Recognized target: " + imageTarget.Name + " height: " + imageTarget.PhysicalTargetHeight);
        }
    }
Пример #2
0
    /// <summary>
    /// Camera Overrise is used to transalte th position and rotation of the Mira Ar Camera according to the current state of the game.
    /// </summary>
    /// <param name="trackable">Image or Object Trackable.</param>
    /// <param name="camera">Mira Ar Camera Camera.</param>
    /// <param name="target">Identified Image or Object Target.</param>
    /// <param name="position">Mira Ar Camera  Position.</param>
    /// <param name="rotation">Mira Ar Camera Rotation.</param>
    /// <param name="scale">Mira Ar Camera Scale.</param>
    public override void CameraOverride(Trackable trackable, Transform camera, RecognizedTarget target, ref Vector3 position, ref Quaternion rotation, ref Vector3 scale)
    {
        var imageTarget = target as ImageTarget;

        if (imageTarget != null)
        {
            // Debug.Log("Position:" + position +", Cam Position: " + camera.position);
            position = imageTarget.PhysicalTargetHeight * scaleMultiplier * position * 0.1f + rotation * positionalOffset;
            rotation = rotation * rotationalOffset;
        }
    }
Пример #3
0
    public override void DrawableOverride(Trackable trackable, RecognizedTarget target, ref Vector3 position, ref Quaternion rotation, ref Vector3 scale)
    {
        var imageTarget = target as ImageTarget;

        if (imageTarget != null)
        {
            var     augmentationToCamera = position - wikiCamera.transform.position;
            float   length    = augmentationToCamera.magnitude;
            Vector3 direction = augmentationToCamera.normalized;
            position = wikiCamera.transform.position + direction * length * imageTarget.PhysicalTargetHeight;
        }
    }
    public override void CameraOverride(Trackable trackable, Transform camera, RecognizedTarget target, ref Vector3 position, ref Quaternion rotation, ref Vector3 scale)
    {
        var imageTarget = target as ImageTarget;

        if (imageTarget != null)
        {
            // position = imageTarget.PhysicalTargetHeight * scaleMultiplier * position * 0.1f + rotation * positionalOffset;
            // rotation = rotation * rotationalOffset;
            Vector3 relativePosition = position - trackable.transform.position;
            position = trackable.transform.position + imageTarget.PhysicalTargetHeight * scaleMultiplier * relativePosition * 0.1f + rotation * positionalOffset;
            rotation = rotation * rotationalOffset;
        }
    }
Пример #5
0
    public void OnExtendedTrackingQualityChanged(RecognizedTarget target, ExtendedTrackingQuality oldQuality,
                                                 ExtendedTrackingQuality newQuality)
    {
        switch (newQuality)
        {
        case ExtendedTrackingQuality.Bad:
            informationText.text        = "Extended Tracking Quality on Target " + target.Drawable + " : Bad";
            informationBackground.color = Color.red;
            break;

        case ExtendedTrackingQuality.Average:
            informationText.text        = "Extended Tracking Quality on Target " + target.Drawable + " : Average";
            informationBackground.color = Color.yellow;
            break;

        case ExtendedTrackingQuality.Good:
            informationText.text        = "Extended Tracking Quality on Target " + target.Drawable + " : Good";
            informationBackground.color = Color.green;
            break;
        }
    }
Пример #6
0
 public void OnTargetLost(RecognizedTarget target)
 {
     informationText.text        = "ObjectTarget: " + target.Drawable + " Lost";
     informationBackground.color = Color.red;
 }
Пример #7
0
 public void OnTargetRecognized(RecognizedTarget target)
 {
     informationText.text        = "ObjectTarget: " + target.Drawable + " Recognized";
     informationBackground.color = Color.green;
 }