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

**URL:** <https://forums.unrealengine.com/t/alternative-to-move-component-to-which-takes-collisions-in-to-account/364066>\
**Category:** World Creation\
**Tags:** move-component-to, unreal-engine, Collision, question, Blueprint\
**Created:** [July 14, 2016, 8:50pm UTC](https://forums.unrealengine.com/t/alternative-to-move-component-to-which-takes-collisions-in-to-account/364066 "2016-07-14T20:50:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_50a9cec8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_50a9cec8](https://forums.unrealengine.com/u/anonymous_user_50a9cec8)\
**Post date:** [July 14, 2016, 8:50pm UTC](https://forums.unrealengine.com/t/alternative-to-move-component-to-which-takes-collisions-in-to-account/364066/1 "2016-07-14T20:50:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AdamBors](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AdamBors](https://forums.unrealengine.com/u/AdamBors)\
**Post date:** [July 14, 2016, 10:31pm UTC](https://forums.unrealengine.com/t/alternative-to-move-component-to-which-takes-collisions-in-to-account/364066/2 "2016-07-14T22:31:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_50a9cec8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_50a9cec8](https://forums.unrealengine.com/u/anonymous_user_50a9cec8)\
**Post date:** [July 16, 2016, 7:19pm UTC](https://forums.unrealengine.com/t/alternative-to-move-component-to-which-takes-collisions-in-to-account/364066/3 "2016-07-16T19:19:38Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ae621fac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ae621fac](https://forums.unrealengine.com/u/anonymous_user_ae621fac)\
**Post date:** [September 25, 2016, 5:17pm UTC](https://forums.unrealengine.com/t/alternative-to-move-component-to-which-takes-collisions-in-to-account/364066/4 "2016-09-25T17:17:46Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Daganar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Daganar](https://forums.unrealengine.com/u/Daganar)\
**Post date:** [April 8, 2017, 11:23am UTC](https://forums.unrealengine.com/t/alternative-to-move-component-to-which-takes-collisions-in-to-account/364066/5 "2017-04-08T11:23:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e46098b7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e46098b7](https://forums.unrealengine.com/u/anonymous_user_e46098b7)\
**Post date:** [April 9, 2019, 11:53am UTC](https://forums.unrealengine.com/t/alternative-to-move-component-to-which-takes-collisions-in-to-account/364066/6 "2019-04-09T11:53:28Z")

</div>

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