Home Forums Game Integration Problem triggering a 2D object

Tagged: ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9677
    Renan
    Participant

    Hey guys! I made a 2D game and I want to trigger a 2D sprite. I know the gaze aware only triggers on 3D objects, thats why I made a 3D invisible sphere with collider that handles the gaze aware (or should handle). It doesnt work and I don’t know the reason. I have a ortographic camera, the 2D sprites and one of them with the 3D sphere with collider and gaze aware. The camera doesnt seem to be the problem.

    #10110
    Alex [Tobii]
    Participant

    Hi @brwolf

    GazeAware component only works for 3d objects at the moment but we are planning to add support for 2d objects as well. For now you can just compare gaze point coordinates with object bounds and add a delay after switching so that it doesn’t flicker between objects that are close to each other.

    #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);
        }
    }
    #11305
    Ira Nikjonas
    Participant

    Alex, Your advice is also valuable for me. Thank you

    #11309
    Alex [Tobii]
    Participant

    Hi @westernira !

    You can try using code samples from this thread:

    2D homemade GazeAware component

    #11337
    Sha Khan
    Participant

    Gergoie, I also try to run your code and It gives error. It’s not working for 3d objects, so, try to correct it.

    #11339
    Gregoire
    Participant

    As I said above this code was not working, so please read the entire thread next time. Plus Alex gave a link below to the solution that we found. Finally can’t correct something if you don’t give information about your specific case

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.