Skip to main content
New Participant
November 4, 2025
Solved

Help with collision event triggering multiple times.

  • November 4, 2025
  • 1 reply
  • 100 views

I am working on a game in horizon world where players throw rocks to hit NPCs (from unity asset bundles). I am encountering an issue with collision detection where a single rock hit is triggering multiple events.

Here's the setup:

  • NPC has a trigger zone 
  • Player throw rocks at the NPC 
  • NPC should register a hit when a rock enters the trigger  and die after 2 hits
  • When NPC dies, it should trigger a single  event to move a bridge to the scene

Current behavior:

  • Using CodeBlockEntityTrigger to detect rock collisions
  • When a rock hits the NPC'c trigger zone, the hit event fires multiple times
  • After 2 hits, the bridge move event gets triggered twice

What I've tried

  1. Using state flags to prevent multiple hit from firing
  2. Tracking hit processing state with boolean flags
  3. Using a set to track rocks that have already hit an NPC

Would really appreciate it if you could provide suggestions on how to fix this issue. Thank you

    Best answer by SeeingBlue

    You may have to share some related code. Physical Collision is known to fire multiple times due to geometry of the objects, but typically triggers only fire once when entered. I suspect something is not behaving as expected in our scripts, or the world is just misbehaving, but shutting it down and returning should resolve that issue.

    1 reply

    SeeingBlue
    Honored Contributor
    November 5, 2025

    You may have to share some related code. Physical Collision is known to fire multiple times due to geometry of the objects, but typically triggers only fire once when entered. I suspect something is not behaving as expected in our scripts, or the world is just misbehaving, but shutting it down and returning should resolve that issue.

    Upcoming Events : Performance Pro - UI Unleashed - Building Responsive & Performant Interfaces Thursday June 19th 5:00 PM PT - Register June Programming Calendar