# Difference between MovementComponent and SetActorLocation?

**URL:** <https://forums.unrealengine.com/t/difference-between-movementcomponent-and-setactorlocation/302753>\
**Category:** Character & Animation\
**Tags:** setactorlocation, unreal-engine, pawn, CPP, question\
**Created:** [December 31, 2014, 1:10pm UTC](https://forums.unrealengine.com/t/difference-between-movementcomponent-and-setactorlocation/302753 "2014-12-31T13:10:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_482d02a4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_482d02a4](https://forums.unrealengine.com/u/anonymous_user_482d02a4)\
**Post date:** [December 31, 2014, 1:10pm UTC](https://forums.unrealengine.com/t/difference-between-movementcomponent-and-setactorlocation/302753/1 "2014-12-31T13:10:39Z")

</div>

Hi,

I’m trying to set up a movement component for my custom pawn. Its a pong game so character movement component doesn’t fit because of the sphere collision and i want a box collision.  
I find it pretty hard to set up in comparison to the setactorlocation which is dead simple 🙂  
Which hurds do you see in the setactorlocation method? can AI be set up with setactorlocation? what would you do? 🙂

thanks 🙂

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [December 31, 2014, 2:12pm UTC](https://forums.unrealengine.com/t/difference-between-movementcomponent-and-setactorlocation/302753/2 "2014-12-31T14:12:47Z")

</div>

You are free to use setactorlocation if you like, movment componets is just ready movement code which can be replaced with your if you want.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_482d02a4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_482d02a4](https://forums.unrealengine.com/u/anonymous_user_482d02a4)\
**Post date:** [December 31, 2014, 2:21pm UTC](https://forums.unrealengine.com/t/difference-between-movementcomponent-and-setactorlocation/302753/3 "2014-12-31T14:21:08Z")

</div>

yes this is true. if i look in the floatingmovementcomponent there are a lot of things happening like ConsumeInputVector(), SafeMoveUpdatedComponent(), UpdateComponentVelocity(). so higher level stuff. But does setactorlocation prevent me from using AI in the movement when my pawn is used by an AI Controller?

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [December 31, 2014, 6:07pm UTC](https://forums.unrealengine.com/t/difference-between-movementcomponent-and-setactorlocation/302753/4 "2014-12-31T18:07:22Z")

</div>

I’mnot sure, you can always make your own movment component too

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_482d02a4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_482d02a4](https://forums.unrealengine.com/u/anonymous_user_482d02a4)\
**Post date:** [January 1, 2015, 7:13pm UTC](https://forums.unrealengine.com/t/difference-between-movementcomponent-and-setactorlocation/302753/5 "2015-01-01T19:13:04Z")

</div>

🙂 never mind i figured out how to create my own movement and it works pretty well 🙂 getting into was bit hard 🙂

---

<div class="post-metadata">

**Author:** ![Missing\_A\_Few\_Heads](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Missing\_A\_Few\_Heads](https://forums.unrealengine.com/u/Missing_A_Few_Heads)\
**Post date:** [April 29, 2018, 7:57am UTC](https://forums.unrealengine.com/t/difference-between-movementcomponent-and-setactorlocation/302753/6 "2018-04-29T07:57:28Z")

</div>

I’ve been looking into this stuff recently. Im still trying to figure out some of the details, always try to verify it yourself… But if you look at source, SetActorLocation ends up calling:

```
RootComponent->MoveComponent( ... )

```

And if you look at GetActorLocation it ends up just returning

```
RootComponent->GetComponentLocation()

```

GetActorLocation and SetActorLocation just interacts with the RootComponent. If you compare that to MovementComponents when it calls SafeMoveUpdatedComponent() you’ll see, if you go far enough down the rabbit hole, that it calls the same MoveComponent function on whichever component is currently set as the UpdateComponent (For characters, this is the root component I believe).

So really, it kinda does the same thing. Its just one is convenient and the other involves a more complicated system which uses different physics implementations to determine where the component should move.
