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!
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
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
//At the moment of collision with the wall
playerRigidbody.velocity.X = -playerRigidbody.velocity.X
You would be amazed at how many THOUSANDS of tutorials there already are out there.