Home › Forums › Game Integration › Problem triggering a 2D object
- This topic has 6 replies, 5 voices, and was last updated 5 years, 3 months ago by Gregoire.
- AuthorPosts
- 08/03/2019 at 02:03 #9677RenanParticipant
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.
14/03/2019 at 15:47 #10110Alex [Tobii]ParticipantHi @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.
05/05/2019 at 15:56 #11241GregoireParticipantHi 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); } }
17/05/2019 at 19:41 #11305Ira NikjonasParticipantAlex, Your advice is also valuable for me. Thank you
20/05/2019 at 22:31 #11309Alex [Tobii]Participant25/05/2019 at 16:12 #11337Sha KhanParticipantGergoie, I also try to run your code and It gives error. It’s not working for 3d objects, so, try to correct it.
25/05/2019 at 23:45 #11339GregoireParticipantAs 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
- AuthorPosts
- You must be logged in to reply to this topic.