Home Forums Game Integration Problem triggering a 2D object Reply To: Problem triggering a 2D object

#11241
Gregoire
Participant

Hi I tried to do what you suggested but I can’t understand why it’s not working, I tried multiple solutions as use a Raycast and everything but it doesn’t work. I figured this could help the community, so that’s my best guess it’s not working but I hope you can help me to fix this. I will make sure to post the solution if I find it meanwhile.

private SpriteRenderer sprite;
void Start () {
    sprite = GetComponent<SpriteRenderer>();
}
void Update () {
    Vector2 _gazePoint = Camera.main.ScreenToWorldPoint( TobiiAPI.GetGazePoint().Screen );
    Debug.Log(_gazePoint);
    if (sprite.bounds.Contains(_gazePoint))
    {
        Debug.Log("Bounds contain the point : " + _gazePoint);
    }
}