Intro to 3D Game Development

0 of 193 lessons complete (0%)

Scripting Part 3: Finishing the Game Loop

Find Out What Entered the Trigger

You don’t have access to this lesson

Please register or sign in to access the course content.

Besides finding out when something moves through a trigger, we can also find out what entity it was. To do this, we’ll add a parameter to the trigger functions. This has the type Entity because any entity can activate the trigger events.

  1. Add a parameter called something to the onTriggerEnter function.
  2. Use : colon to give the parameter the type Entity.
  3. Add something.name into the console.log, and use + plus to attach it to your string.

Repeat this with the onTriggerStay and onTriggerExit functions