# Why my topdown 2D character slows down when running diagonally along a wall ?

**URL:** <https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534>\
**Category:** Blueprint\
**Tags:** Input, topdown, unreal-engine, Collision, Blueprint, question\
**Created:** [February 24, 2024, 10:10pm UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534 "2024-02-24T22:10:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![zKillerShootz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zKillerShootz](https://forums.unrealengine.com/u/zKillerShootz)\
**Post date:** [February 24, 2024, 10:10pm UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/1 "2024-02-24T22:10:07Z")

</div>

Hey, so I’m making a top down 2D game where the character is 2D but the world is 3D.

Currently, I got this 8-directional sprite character, you can use WASD to walk (600 cm/s max speed and 2500 max acceleration) and you can also press shift to run (950 cm/s max speed 800 max acceleration). You can also move the topdown camera with your mouse.

Here are the character’s [movement settings](https://prnt.sc/3XJscLYNWBdC)

Also this is blueprints for the WASD/Sprint [movement](https://prnt.sc/bCW84yQFNPhE) (Sorry if it looks messy I’m a beginner)

Now, the actual issue, I’m making a horror game with chase aspects to it, and I want the chases to be fast paced, my problem is when my character runs diagonally it gets slowed down by the wall. You can watch a video [[here]](https://streamable.com/xhijb2)

This can get frustrating because you can get stuck during chase and it will make the gameplay feel clunky [(example)](https://streamable.com/uueo7l)

I tried lowering the ground friction which works BUT the gameplay feels like I’m running on ice.

I want something like Undertale when you walk diagonally towards a wall it makes you walk along [with it](https://streamable.com/c95jkj)

What I think Undertale has is when you are moving in a direction (Let’s pretend it’s left) once you hit a wall in your left, your character simply stops moving, so when you are pressing Up Left for example, once you hit a wall the Left input is ignored and only the Up input is affecting the character.

I want to recreate that mechanic, any help is appreciated 🙏

---

<div class="post-metadata">

**Author:** ![Leomerya12](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/leomerya12/32/926321_2.png) [@Leomerya12](https://forums.unrealengine.com/u/Leomerya12)\
**Post date:** [February 24, 2024, 11:47pm UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/2 "2024-02-24T23:47:29Z")

</div>

Hello,

I need clarification:

If the player is against the wall and they press UP or DOWN, the character moves just fine? But if they are against the wall and they press UP + LEFT/RIGHT or DOWN + LEFT/RIGHT, you encounter the issue?

---

<div class="post-metadata">

**Author:** ![badimo57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@badimo57](https://forums.unrealengine.com/u/badimo57)\
**Post date:** [February 25, 2024, 3:38am UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/3 "2024-02-25T03:38:20Z")

</div>

You should keep that to tell the player not to run into walls. Just saying. That is probably because it generates collisions too many times. Scratch is a good example of this.

---

<div class="post-metadata">

**Author:** ![Leomerya12](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/leomerya12/32/926321_2.png) [@Leomerya12](https://forums.unrealengine.com/u/Leomerya12)\
**Post date:** [February 25, 2024, 3:51am UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/4 "2024-02-25T03:51:16Z")

</div>

You beat me to it. I was going to say that this is a usual feature in virtually all games. But maybe this person wants to treat it like the old-school RPG movements, in which case, maybe the LEFT/RIGHT inputs need to be ignored when touching a wall.

That’s why I waited for them to give me the specific input.

---

<div class="post-metadata">

**Author:** ![badimo57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@badimo57](https://forums.unrealengine.com/u/badimo57)\
**Post date:** [February 25, 2024, 4:00am UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/5 "2024-02-25T04:00:34Z")

</div>

Thank you, thank you for the 1st place trophy…

Anyway, I need to know if the character is a 3D object, a flat plane, or on top of a texture, or the 2D character feature in the UI.

---

<div class="post-metadata">

**Author:** ![zKillerShootz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zKillerShootz](https://forums.unrealengine.com/u/zKillerShootz)\
**Post date:** [February 25, 2024, 1:52pm UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/6 "2024-02-25T13:52:07Z")

</div>

Only when they press UP + LEFT/RIGHT or DOWN + LEFT/RIGHT against the wall the character gets slowed down

---

<div class="post-metadata">

**Author:** ![zKillerShootz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zKillerShootz](https://forums.unrealengine.com/u/zKillerShootz)\
**Post date:** [February 25, 2024, 1:55pm UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/7 "2024-02-25T13:55:53Z")

</div>

It’s from a plugin called PaperZD.  
I followed [this tutorial](https://youtu.be/z1RMDMKcROQ?t=546) to make it

---

<div class="post-metadata">

**Author:** ![zKillerShootz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zKillerShootz](https://forums.unrealengine.com/u/zKillerShootz)\
**Post date:** [February 25, 2024, 2:02pm UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/8 "2024-02-25T14:02:37Z")

</div>

> But maybe this person wants to treat it like the old-school RPG movements

Yeah that’s exactly what I want to do.

---

<div class="post-metadata">

**Author:** ![Leomerya12](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/leomerya12/32/926321_2.png) [@Leomerya12](https://forums.unrealengine.com/u/Leomerya12)\
**Post date:** [February 25, 2024, 4:53pm UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/9 "2024-02-25T16:53:45Z")

</div>

Another question:

When the character is running alongside the TOP and BOTTOM walls, is the issue the same, but shifted? Where they only slow when LEFT + UP/DOWN or RIGHT + UP/DOWN are pressed?

If so, then you can have a condition like:

1. When player is against a VERTICAL wall, disable ← and → .
2. When player is against HORIZONTAL wall, disable ↑ and ↓.

You can place a BOOLEAN between your X and Y inputs that gate-checks for any OVERLAP EVENTS.

You can place a COLLISION BOX around your character, and when that box comes in contact with a wall it will adjust the BOOLEAN value.

You’ll just need to make sure your walls are blueprinted to be HORIZONTAL or VERTICAL.

---

<div class="post-metadata">

**Author:** ![badimo57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@badimo57](https://forums.unrealengine.com/u/badimo57)\
**Post date:** [February 25, 2024, 4:54pm UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/10 "2024-02-25T16:54:11Z")

</div>

Okay, I get it. If you want the character to keep moving fast, then remove input left or right when hitting any walls, and vice versa. I am gonna figure out how to do that

---

<div class="post-metadata">

**Author:** ![badimo57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@badimo57](https://forums.unrealengine.com/u/badimo57)\
**Post date:** [February 25, 2024, 4:55pm UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/11 "2024-02-25T16:55:14Z")

</div>

Oh wait, it’s kinda easy. Just use collision events with the wall and a box the size of you, unless PaperZD doesn’t allow it.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 26, 2024, 4:55pm UTC](https://forums.unrealengine.com/t/why-my-topdown-2d-character-slows-down-when-running-diagonally-along-a-wall/1710534/12 "2024-03-26T16:55:38Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
