- Home /
Jittery movement when colliding with a wall 2D.
So I am creating a 2D platformer in unity and the problem is that when i collide with something the player shakes like crazy.Here is the movement code:
if (Input.GetKey (KeyCode.D)) { transform.position += Vector3.left speed Time.deltaTime; playerSprite.flipX = false; gunSpawn.transform.localPosition = new Vector2 (0.177f, 0.0334f); anim.SetBool ("isWalking", true); } else anim.SetBool ("isWalking", false); if (Input.GetKey (KeyCode.A)) { transform.position += Vector3.left speed Time.deltaTime; playerSprite.flipX = true; gunSpawn.transform.localPosition = new Vector2 (-0.177f, 0.0334f); anim.SetBool ("isWalking", true);
I kinda know what the problem is but idk how to implement it with Physics2D.Raycast . I would like it to be with Physics2D and not with velocity if possible. Thank you!
Your answer
Follow this Question
Related Questions
Simple Rigidbody2D movement and jump 0 Answers
Clipping bug I have encountered... 0 Answers
Rigid Body Movement (Mobile Issue) 3 Answers
Ground in 2D Platformer Skewing 0 Answers
Weird behaviour after Collision? 0 Answers