Player character moves faster after colliding with a wall

Hi guys,

I’m having some trouble with my main characters movement. After my character collides with a wall, or anything else, he’ll move way faster in the opposite direction afterwards.

Imagine I run to the left, until I hit a wall, afterwards the character will run a lot faster to the right, and a lot slower to the left. Also he somehow seems to be rotated, translating him forward is making him move slightly off the direction he’s looking.

Here’s the snippet that handles the movement:

		if(moveStick.x >= 0.2 || moveStick.y >= 0.2 || moveStick.x <= -0.2 || moveStick.y <= -0.2){
			newHeading = System.Convert.ToInt32 (Mathf.Atan2(moveStick.x, moveStick.y) * Mathf.Rad2Deg);
			transform.eulerAngles = Vector3(0, newHeading, 0);
			
			transform.Translate(Vector3.forward * speed * Time.deltaTime);

Any help on this would be very appreciated…

it seem like it collides to the wall (make changes to it’s velocity)
the problem is with the translate

maybe you shld use character controller instead and use controller.move or controller function instead of translate…
so that it will not collide with the wall

if you just wan the object not to change speed,you can just tick the Istrigger box

Or if you are using rigidbody freeze it’s position and rotation.