how prevent actor going through other actors when moving location

hi
i have an actor called “char2” :

then will spwan it in the world with this node:

and then i will move its location by “set actor location” node

problem is when actor position go through another actor i want prevent this:

as you can see in the image i moved my actor location and it went inside “white cube” and i dont want this.
how can i prevent this ?

i changed values of “sweep” and “teleport” but didnt make any sense.

Hey @dashsaeid!

The problem here is that you are using SetActorLocation- which does not account for collision. You also do not have collision volumes on your actors, which is how you detect collision and block intersections and overlapping. You’re working with primitive objects and so you will have primitive interactions.

That being said I highly appreciate your attention to pertinent information when asking for help! No fluff, and exactly what was needed to figure out the issue!

I highly suggest going through this tutorial, it covers about 90% of the bases and is a huge help getting off the ground! The skills you learn here give a great foundation and then some across a wide variety of functions within UE5.

3 Likes

@Mind-Brain
I watched the tutorial you introduced completely.
I created a box collision component inside the char2 actor and then placed all the static meshes inside it and In the box collision settings, I set the collision presets to BlockAll:

However, when I’m moving the char2 actor in the level, it still goes inside the white cube, and I don’t know what to do to prevent it from entering and make it stop beside it instead.

Awesome!

So there is a little nuance to the collision settings.
Ignore>overlap>block.

For two things to block each other, they must each block the opposing type. If one is set to ignore or overlap, even though one is set to block, it will pass through.

Because of this, you will want to check your cube that you’re colliding with, make sure it has collision as well and is set to block the char2! :slight_smile:

Hey @dashsaeid! Just checking on your progress, did you get it figured out? Let us know if we can help further, and if not, let us know what the solution was for future answer seekers! :slight_smile:

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