Download

How to check if a point is inside a collider?

Hi, I want to spawn an actor in a random position in the navmesh. I generate a random point, but I want that the point generated is outside certain colliders. In the spawn actor function theres a boolean ‘Spawn even if colliding’, but its not working. Also, I don’t know how get if the actor has not been created. So, my idea now is to get the point generated, check if it is inside those colliders, then: A. If it is inside, generate another point. B. If it is not inside, create the actor there. But I don’t know how to check if a point is inside a collider component.

Thanks in advance.

Have you tried using the Event Actor Begin Overlap on the actor you are spawning? If any of the colliders return true, then destroy the actor, and try again.

I have this, but not working:

AIDark.PNG

Edit: He’s spawning inside those colliders D:

Are you at least getting as far as the Branch box? The rest of the code has gone off the right of the image, so i can’t see it, but it doesn’t look as if you have looped back to the start after destroying the actor that was in the collider area.

Also, try AnswerHub. That will give you a quicker and more reliable answer.

https://answers.unrealengine.com/

It isn’t even firing the ‘OnComponentBeginOverlap’ event D: Just bind the event, but it is not firing it.