Scripting

Search The Documentation:

  1. Home
  2. Docs
  3. Scripting
  4. Built-In Functions
  5. onTriggerEnter

onTriggerEnter

Platform Compatibility

PC Mac OSX Oculus Quest
X X X

onTriggerEnter runs when first entering a trigger, which is not solid and will happily allow a solid object to sit within its trigger zone.

Parameters:

  • name
    • A string showing the name of the object
  • tag
    • A string showing the tag of the object
  • object UID
    • A string for custom numbering of objects / types, use tonumber(uid) to convert it to a number in the script
  • object EID
    • An integer identifier number that only exists for this specific object we are colliding with, is not the same as a UID which can be manually assigned in the editor or via script

Example:

1
2
3
function onTriggerEnter(name, tag, uid, eid)
    obj.set3DText("I entered the " .. name .. " zone")
end

For more information on when this function will activate, see the Collision and Rigidbody pages.

Tags
Was this article helpful to you? Yes No

How can we help?