# Movement (853609)

**URL:** <https://discussions.unity.com/t/movement-853609/853609>\
**Category:** 2D\
**Tags:** 2D, Question\
**Created:** [August 28, 2021, 7:42am UTC](https://discussions.unity.com/t/movement-853609/853609 "2021-08-28T07:42:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PilotNilson](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@PilotNilson](https://discussions.unity.com/u/PilotNilson)\
**Post date:** [August 28, 2021, 7:42am UTC](https://discussions.unity.com/t/movement-853609/853609/1 "2021-08-28T07:42:45Z")

</div>

Can Someone help me!? I want to make my character to run endless, and when he is touching to right wall to start move to the left , and then again when he is touching the left wall to start moving to the right ,you got the idea, an endless runner!

---

<div class="post-metadata">

**Author:** ![rockfalls9](https://avatars.discourse-cdn.com/v4/letter/r/b38774/32.png) [@rockfalls9](https://discussions.unity.com/u/rockfalls9)\
**Post date:** [August 28, 2021, 11:23am UTC](https://discussions.unity.com/t/movement-853609/853609/2 "2021-08-28T11:23:35Z")

</div>

Y is the direction of the character’s running, and X is the offset relative to the center. The gray lines are the boundaries for the runner  
Image

 ![7455683--914888--upload_2021-8-28_14-17-32.png](https://europe1.discourse-cdn.com/unity/original/4X/b/e/4/be4922d89163848828c6d60219aa8ccfd02dfb86.png)

Add the collider component on the gray walls and put the Is Trigger checkbox on it. After the character contacts these walls, then you change the direction of speed along the X-axis to the opposite direction.

Pseudocode

```csharp
//At the moment of collision with the wall
playerRigidbody.velocity.X = -playerRigidbody.velocity.X

```

---

<div class="post-metadata">

**Author:** ![Kurt-Dekker](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kurt-dekker/32/101578_2.png) [@Kurt-Dekker](https://discussions.unity.com/u/Kurt-Dekker)\
**Post date:** [August 28, 2021, 11:39pm UTC](https://discussions.unity.com/t/movement-853609/853609/3 "2021-08-28T23:39:56Z")

</div>

> [@PilotNilson](#):
>
> an endless runner!

You would be amazed at how many THOUSANDS of tutorials there already are out there.

![7456829--915134--Screen Shot 2021-08-28 at 4.39.29 PM.jpg](https://europe1.discourse-cdn.com/unity/original/4X/0/9/d/09db07853ccff720e9b6cf2e33508cdf7edabbe1.jpeg)
