Alternative to "Move Component to" which takes collisions in to account

Hi folks,

I’m hoping someone can help me. I currently have a destructible mesh blueprint which is set up to move to a random location using the “Move component to” node. The movement looks perfect and is working exactly how I want, however much to my dismay I have discovered that the “Move component to” node doesn’t take in to account collisions, so the mesh can freely go through walls.

What is the best alternative to “Move Component to” which will take collisions in to account? Currently the only component in the blueprint is the destructible mesh. I did try adding a box collider to the blueprint and trying the “On component overlap” event to the stop pin of the “Move Component to” not but that didn’t work.

Many thanks

You could try tracing from the current location to the random location, and then checking if there was a hit. If yes, move to the hit location. If not, simply move to the random location.

Be sure to store the random location to a variable, so that you don’t generate an other one if the trace doesn’t hit.

Thanks very much! Used a sphere trace and set to the radius to the object’s Z bound. Its not perfect but it will do for now!

Could someone please demonstrate what these blueprints would look like? I’m having a significant amount of trouble getting my side scroller character to stop dashing through obstacles…

Calling SetWorldLocation() on the root component allows you to specify a “sweep” which will stop when it’s blocked and return you a list of hit results.

How can we do that ?? I’m facing the same problem. Can anyone help me please I’m really new with unreal engine