# Override OnMovementModeChanged causes Jump lag

**URL:** <https://forums.unrealengine.com/t/override-onmovementmodechanged-causes-jump-lag/433821>\
**Category:** Character & Animation\
**Tags:** charactermovementcom, unreal-engine, question\
**Created:** [September 14, 2018, 8:54pm UTC](https://forums.unrealengine.com/t/override-onmovementmodechanged-causes-jump-lag/433821 "2018-09-14T20:54:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slavical](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Slavical](https://forums.unrealengine.com/u/Slavical)\
**Post date:** [September 14, 2018, 8:54pm UTC](https://forums.unrealengine.com/t/override-onmovementmodechanged-causes-jump-lag/433821/1 "2018-09-14T20:54:31Z")

</div>

I have overwritten OnMovementModeChanged function found in CharacterMovementComponent. The issue is that whenever the code is used, it causes a delay with the in-engine jump function.

For example, whenever the code is compiled and used, I have to push the jump button twice before I can jump again. Even if I wait several seconds before pushing the jump button, it still requires me to push it twice.

I know the code is the issue because when I take the code out and recompile, I can push the jump button as soon as the character lands, and the character will jump again.

Perhaps I didn’t override it correctly?

Header File:

`virtual void UCharacterMovementComponent::OnMovementModeChanged(EMovementMode PreviousMovementMode, uint8 PreviousCustomMode) override;`

C++ File:

`void AClassName::OnMovementModeChanged(EMovementMode PreviousMovementMode, uint8 PreviousCustomMode)
{
PrevMovementMode = PreviousMovementMode;
}
`

---

<div class="post-metadata">

**Author:** ![Slavical](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Slavical](https://forums.unrealengine.com/u/Slavical)\
**Post date:** [October 5, 2018, 4:48pm UTC](https://forums.unrealengine.com/t/override-onmovementmodechanged-causes-jump-lag/433821/2 "2018-10-05T16:48:34Z")

</div>

Alright, so after so more research, I found my answer. The issue was that I didn’t call the super when I over wrote the OnMovementModeChanged function.

.h file

```
virtual void AMyClassName::OnMovementModeChanged(EMovementMode PrevMovementMode, uint8 PreviousCustomMode) override;

```

C++ file

```
void AMyClassName::OnMovementModeChanged(EMovementMode PrevMovementMode, uint8 PreviousCustomMode)
{
	Super::OnMovementModeChanged(PrevMovementMode, PreviousCustomMode);
	
	/* Your logic goes here */
}

```

Do the following and you will have no issues creating your own logic or setting variables (like getting the previous movement mode).
