How to make a box that only blocks the enemy that spawns it?

I have an enemy that spawns a box in front of itself and walks around it.
The box is invisible to the player, and deletes itself after some time.
But how do I make sure that only that one specific box, blocks the instance that spawned it?

What I’m after is to make the enemy movement more interesting, so it doesn’t just go straight after the player.

This is pretty creative, ha. You sure there isn’t a better way than throwing boxes under their feet?

Perhaps you could describe / show a desired behaviour?


Alternatively, look into how collision channels work. But it will end up being neither pretty nor straighforward this way.

Yeah I think it would probably be easiest to get the enemy to just walk in random directions, but I know nothing about that.

The desired behavior is that found in Risk of Rain 2

How are the enemies moving towards the player atm, what method?


This?

Playing with collisions, Block only pawn ? or Vehicle…idk if u can create a specific filter.

Add a second collision box, bigger, and ask for a tag, or interface…then activate the other , the good one.

is it possible to create tags automatically? for each instance of the same enemy?

Yes, and use it as a seed

You will need to script the desired behaviour. Simple behaviours can be scripted into an actor or a component, for more complex stuff look into Behaviour Trees.


Here’s a couple of examples demonstrating how basic logic could be set up, they’re pretty crude but hopefully you can make them better:

  • these guys will attempt to keep their distance:


  • these baddies will get to the player but not in a straight line, they must do some weaving first.

Added some debugging to visualise it better.


  • these zombies wander somewhat randomly around the player but will eventually find them as the radius gets tighter with every attempt:

image


Hope this helps a little.

Thank you as always :smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.