At the last time the resource actors weren’t pawns/characters, just actors, but the performance was still poor until I had done the spawners.
OnComponentBeginOverlap is a bit more reliable for this.
Overlaps only occur when the character is actually overlapping the EDGE of the volume. So while an object is completely enveloped, they’re not overlapping. I know, it’s strange wording.
It’s probably just having an easier time because it’s not having to keep track of all of the actors’ details.
No, it does not work as you write. I have tested and OnComponentBeginOverlap occurs immediately after spawning. So I will do with OnComponentEndOverlap.
Sorry about that, you’re right, I had it backwards. Because of the spawning, it checks for any collisions on spawn.
Yes, use OnComponentEndOverlap!
And, probably, the difference 10 meters between the enter and exit spheres is too small. I will done it 50 meters (100 vs 150).
Also, would it be useful to make those spheres to overlap only Pawn and Vehicle channel, and ignore all others?
Feel free to play with those numbers and make it how you’d like, figure out what works for you! Even something like 400m to spawn and 500 to despawn will still be much better than all actors being spawned at all times!
That solely depends on what you set your players’ object channel as under their collision!
I will say: for MOST projects, yes. If you use a custom object channel for your player, you’ll want to use that.
Vehicle you may as well tell to not overlap, because it’s still only going to look for children of “Ally”, which I assume a vehicle will not be. IF the vehicle would be a child of that then sure, use vehicle for overlap as well.
Otherwise, someone could leave a vehicle somewhere to keep actors alive and bog down the server.
I can also add check if the overlapping actor is vehicle. Or has the player to not see the resource actors if he is on the vehicle?
Depending on how you set up vehicles, it may still overlap from within the vehicle. As long as you don’t disable collision on Ally, the collision will go through the vehicle and still trigger, if that’s what you’re asking!
@Mind-Brain, but such a question: what if two players enter one trigger, then one of them exits? For the second player, the resource actors will also suddenly disappear?
Hmm. That’s a good observation. Yes, it would make them disappear. I thought about that, and decided an array of colliding players would be the solution, and I scrolled down to see that you had the same idea! Sorry, I was out for the weekend, is this working okay for you?
Hello again @Mind-Brain! I haven’t checked specifically this construction for two players, but I have earlier implemented several similar constructions, and they work. So I think this one also works. Now I am busy with another project, so I don’t have much time for this one. Maybe I will fully test soon.