Download

Dealing with (phsyics) actor spawn problems

Hey there!

I am really out of ideas apart from engineering this to a point it wouldn’t be fun anymore but…

How do you deal with the problems occuring when spawning multiple actors at certain locations.

For example, if a player is mining a rock and you want to spawn pebble somewhat near that… Or if he kills an enemy and his items drop at his death location. Or if you want to spawn a squad of AI enemies relatively close to each other… Sadly, the “Try to adjust location, but always spawn” option doesn’t help that much.

Physics objects often spawn inside each other and get stuck and glitch or sometimes even spawn underground and fall through the ground. I managed to reduce the issue by adjusting the spawn location with some random vector, but it still happens sometimes.

For spawning AI, the “Get Random Reachable Point” works rather well, but I still wonder if there’s any better solution.

Also, how would you handle game critical spawns like very rare or even unique drops like quest items or maybe even boss enemies for example. Things that have to spawn correctly and be reachable.

  • How can we avoid obstruction
  • How can we relocate to a valid spawn location

Thanks for all input and have a nice weekend!
LordStuff

When you spawn there is an option to check collision.

Anyway on an engineering standpoint spawn the items one at a time with a few milliseconds between each other. That way they can spawn and not be inside one another.

To avoid obstructions the options I mentioned should already do it…
if you want to take over for it, spawb the item, check visibility overlaps, if anything is overlapping adjust position.
after you find a false result (no overlaps) enable physics.

Oh well.

I didn’t come across the idea, that actors spawned in the same frame might not be ready for handling collision with each other…

Thank you for answering, I will try that!

Might as well just leave the physics for now and spawn them on the ground as statics. That takes care of a lot of glitchiness :'D

Depends on what it is you are trying to spawn and how. But generally yes.
if you create and place an actor without collision there is 0 possibility of it glitching or causing major problems.

careful with that too though. If they have collision you can unintentionally cause the player capsule to get stuck or be thrown around.