Log in or register to post comments

How to get model orientation of tracked model target

September 3, 2020 - 7:23am #1

Hello,

I am new and try to get experience with vuforia model recognition.

How it is possible to get information witch side of the model is tracked.

We test with a model target generated from a CAD Model.

And want show separate information for the front and back side.

The recognition is good, but I need different actions for back side and front side of object.

Thank you for your help in advance.

 

bye

Chris

How to get model orientation of tracked model target

September 9, 2020 - 5:36am #2

Hi,

one approach could be to first define what is the front and back side by adding a GameObject on this positions.

Then I would calculate the distance between the objects and the camera. The shorter distance should be always the side you are looking at and you can activate the object.

Something like this:

public Transform ARcamera;
    public GameObject Front;
    public GameObject Back;

    void Update()
    {
        float Distance1 = Vector3.Distance(ARcamera.position, Front.transform.position);
        float Distance2 = Vector3.Distance(ARcamera.position, Back.transform.position);
        if (Distance1 < Distance2)
        {
            Front.SetActive(true);
            Back.SetActive(false);
        }
        else
        {
            Back.SetActive(true);
            Front.SetActive(false);
        }

    }
Log in or register to post comments