Log in or register to post comments

adding/interacting with box collider on a ground plane

April 19, 2020 - 1:54pm #3

Hey y'all,

 

I'm trying to make a 6-foot circle on the ground around the user that turns red when someone enters the circle.

 

I added a box collider around the ground plane and set it as a trigger, then added this script that should enable the red circle and disable the green circle when someone enters it:

 

public class TriggerScript : MonoBehaviour

{

    public GameObject redCircle;

    public GameObject greenCircle;



    public void OnTriggerEnter(Collider other)

    {

        redCircle.SetActive(true);

        greenCircle.SetActive(false);



    }



    public void OnTriggerExit(Collider other)

    {

        redCircle.SetActive(false);

        greenCircle.SetActive(true);

    }



}

 

I think the issue is that the box collider is expecting to interact with another GameObject, not a person.

 

Anyone have any recommendations as to how I should go about this? Thanks!

 

adding/interacting with box collider on a ground plane

April 20, 2020 - 12:10am #2

Hi,

I believe you are on the right track. Yes, the box collider is expecting to interact with another GameObject that also has a Box collider.

Try adding a box collider to the AR Camera and moving in the green circle. Please also add a Debug.Log("Enter circle") to OnTriggerEnter to check in the log if the collision is triggered.

Thank you.

Vuforia Engine Support

adding/interacting with box collider on a ground plane

April 21, 2020 - 11:02am #1

Thanks for the reply!

 

My current implementation has a ground plane with the circle on it directly under the ARCamera, so the circle is always around the user. I am trying to see if there is any way to collide with someone who enters the circle.

 

Let me know!

Log in or register to post comments