Stop collision checks for instances off screen

  • If you have a ton of 1 object that has collision checks with it, is there a way to "disable" the checks when other instances are off screen so it doesn't use up resources?

  • "Is on screen" -> set collision enabled

    X "Is on screen" -> set collision disabled

  • 7Soul - okay let me ask you this. Is that the same as putting a "if object is on-screen" collision check?

  • Right. He's trying to point out you can right-click on a second copy of your "if object is on-screen" event and hit 'invert.' This will be the equivalent to "if object is NOT on-screen" so you could use one event every second or so to enable the stuff on screen and one event to disable what is not on screen.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Position checks are much quicker than collision checks.

    If you have

    -> On collision

    Is on screen

    You're first checking the collision, and THEN checking if it's on screen (events with a green arrow always run first).

    By disabling collisions, those objects won't even be picked for the collision event

    But if you want to be 100% sure, you can try both methods, and check the profiler in the debugger.

  • 7Soul - I had no idea triggers were played first regardless of hierarchy.

    Do I need an else for the collision checks? (I'm going to have a bunch of them for various objects)

  • Yeah you can use an else instead of inverting the condition, I guess it makes no difference.

    The thing I said about hierarchy is only for when you can't move a condition on top of a trigger. You can make it a sub-event, in which case it won't be the first thing

  • 7Soul - thanks for the help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)