# Custom Pawn Movement Component

**URL:** <https://forums.unrealengine.com/t/custom-pawn-movement-component/279308>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [April 1, 2014, 6:32pm UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308 "2014-04-01T18:32:53Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![reefG](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@reefG](https://forums.unrealengine.com/u/reefG)\
**Post date:** [April 1, 2014, 6:32pm UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308/1 "2014-04-01T18:32:53Z")

</div>

Hello,

I have a default pawn that is basically a box component driven by physics and I want to be able to control it’s motion via player inputs.

I have successfully implemented the new default pawn, however I don’t fully understand the best way to control it. Ideally I want to be able to update it’s velocity based on player inputs, Do I have to implement a custom Movement component, and if so how do I do that!

Any help reality appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![order66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/order66/32/906575_2.png) [@order66](https://forums.unrealengine.com/u/order66)\
**Post date:** [April 3, 2014, 5:10pm UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308/2 "2014-04-03T17:10:26Z")

</div>

I think the easiest way should be doing it the way it is done by default:

Add a PawnMovementComponent and create a function “AddInput” or something where you call the “AddInputVector” function of the PawnMovementComponent:

virtual void AddInputVector(FVector WorldVector, bool bForce = false);

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [April 3, 2014, 5:29pm UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308/3 "2014-04-03T17:29:37Z")

</div>

#Custom Character Movement Comp

I have a wiki tutorial on this exact subject here:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

this is for making your own C++ custom character movement class and overriding any virtual functions of the base class that you want!

Rama

---

<div class="post-metadata">

**Author:** ![reefG](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@reefG](https://forums.unrealengine.com/u/reefG)\
**Post date:** [April 5, 2014, 12:33pm UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308/4 "2014-04-05T12:33:19Z")

</div>

Thank you, exactly what I was looking for!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_cfd9064d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_cfd9064d](https://forums.unrealengine.com/u/anonymous_user_cfd9064d)\
**Post date:** [June 14, 2014, 11:58pm UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308/5 "2014-06-14T23:58:24Z")

</div>

Hi Rama I am following your C++ custom character movement tutorial that you linked and I can’t quite get things working correctly. I added the custom movement component class and followed your tutorial exactly. Everything compiles fine but when I run the game in the editor I hit a breakpoint seemingly being caused by my Character’s reference to CharacterMovement being NULL. I also noticed that his base movement component is also NULL. I was wondering if maybe there was a change to UE 4.2 that may have caused this to happen (I know they altered a few things in CharacterMovementComponent) or if you knew anything about this. (It is also very possible that I just screwed something up).

---

<div class="post-metadata">

**Author:** ![tumi\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tumi\_1](https://forums.unrealengine.com/u/tumi_1)\
**Post date:** [July 4, 2014, 2:05pm UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308/6 "2014-07-04T14:05:41Z")

</div>

Hi Rama, i can confirm what Alryco wrote - did implement your tutorial but only get a nullptr when trying to “Cast\< UMyMovementComponent \>( CharacterMovement )”;

---

<div class="post-metadata">

**Author:** ![GeekyPayback](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GeekyPayback](https://forums.unrealengine.com/u/GeekyPayback)\
**Post date:** [July 11, 2014, 12:34pm UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308/7 "2014-07-11T12:34:20Z")

</div>

I’ve been looking at this well and I kept making noise on the forum. Eventually someone told me that in 4.2 you have to delete + recreate the pawn. I’ve updated Rama’s wiki instructions.

The person that informed me said there was a fix in github so hopefully wont need these extra steps in 4.3

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [July 12, 2014, 11:22pm UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308/8 "2014-07-12T23:22:04Z")

</div>

I can confirm this as well as happening in 4.2

It is a huge problem!

I dont know what to do about it 🙂

Rama

---

<div class="post-metadata">

**Author:** ![GeekyPayback](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GeekyPayback](https://forums.unrealengine.com/u/GeekyPayback)\
**Post date:** [July 13, 2014, 8:32am UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308/9 "2014-07-13T08:32:22Z")

</div>

Delete + recreate the character or wait for 4.3. I’ve updated the wiki.

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [July 14, 2014, 4:21pm UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308/10 "2014-07-14T16:21:37Z")

</div>

#Robert M. Fixed this here

> **[Adding custom movement component](https://forums.unrealengine.com/showthread.php?16514-Adding-custom-movement-component&p=95377&viewfull=1#post95377)**
>
> I’ve followed Rama’s tutorial here But now that the component is working, I cant actually move at all. The code below definitely runs and displays stuff on the screen. //Tick Comp void UpXCharMovementComponent::TickComponent(float DeltaTime,...

Link to github to implement fix locally while not yet up to 4.3 / whenever his change is fully brought into the engine.

[https://github.com/EpicGames/UnrealEngine/commit/fab71f76b717a9bafbb0b91831ebb44cd73f0f11](https://github.com/EpicGames/UnrealEngine/commit/fab71f76b717a9bafbb0b91831ebb44cd73f0f11)  
Rama

---

<div class="post-metadata">

**Author:** ![Herbie216](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Herbie216](https://forums.unrealengine.com/u/Herbie216)\
**Post date:** [November 11, 2015, 11:46pm UTC](https://forums.unrealengine.com/t/custom-pawn-movement-component/279308/11 "2015-11-11T23:46:43Z")

</div>

Hey Rama I can’t seem to find a way to private message you on here so I’m just posting this here in hopes that you’ll see it. How do go about replicating a player/AI controlled pawn/pawn’s movement? There are a ton of articles about character replication that depend so much on the character movement component that they aren’t applicable to pawns for someone still learning and the character movement component itself is so restricting if you’re not doing a humanoid for a shooter/platform it seems. Any help would be so appreciated.
