Triggering 2D screen on collision

I want to trigger a quiz screen on collision and it should disappear after i answer the question. I am total newbie. How can i do it? Is there any example i can refer to?
https://playcanvas.com/editor/scene/1072109

Hey, quiz screen should be an entity that you can easily enable by first finding it in the hierarchy and then enabling it,

let quizScreen = this.app.root.findByName("QuizScreenNameInHierarchy");
quizScreen.enabled = true;

To study more about entity, you can refer here

3 Likes

Building off of @saif reply…you could add his code to your Trigger Entity and have a collision with your Trigger Entity enable the Quiz Screen Entity. So basically unhide your Quiz Screen once a collision is detected by the Trigger Entity’s Collision body.

2 Likes

Actually, I am using p2.js which a bit different from the in built physics engine. Also, my game script is attached to root. Game.js takes entity as one of the parameters. So simply enabling and disabling ‘2D screen’ like this doesn’t seem to work.