playMaker

Author Topic: Alternative to "On Trigger Enter"  (Read 321 times)

SawyerK

  • Junior Playmaker
  • **
  • Posts: 92
Alternative to "On Trigger Enter"
« on: November 16, 2022, 10:55:30 AM »
Hi!

I'm creating some basic trigger mechanic for enemy npcs and I would like to know if there is a better alternative to "On Trigger Enter". There is "On Trigger Stay" but it's just way too performance heavy to use it on a bunch of npcs. "On Trigger Enter" works well but it doesn't trigger if an object is already in the trigger collider so it's not that useful.
Is there a way to make a trigger with like booleans or whatever else like "On Trigger Stay"?

Thank you!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Alternative to "On Trigger Enter"
« Reply #1 on: November 17, 2022, 01:12:07 AM »
Hi.
Overlap actions / cast actions (box cast / sphere cast)
you can find several on the Ecosystem

prefer the ones that can set a repeat interval (or loop and use a next frame event advanced), if you don't have to check every frame then you can set a interval like every x frames.
this will increase performance

for example you have 10 trigger checking every frame with a 60 frame per sec.
that would be 600 checks

if you check every 3th frame, this will go down to 200 checks