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…