- Home /
what collider to use for 2d movement?
Im using a CapsuleCollider2D collider on my player character and my movement code is
float direction=Input.GetAxis("Horizontal); rb.velocity = new Vector2(rb.velocity.y, walkSpeed*direction);
when im using a capsule collider my player jumps up and down when im moving left to right. I've tried making rb.velocity.y=0 while my player is walking, but that breaks my jump.
Answer by MTSKrishna · Mar 10, 2021 at 03:58 PM
Try using polygonal collider 2d for some what prefect border collide for your Player and perfect movement or box collider 2d! It may help You :) ... or check your Player's Rotation ?
Thanks for the advice, but it turns out it was actually just the tile map collider. I wasn't using a composite collider so the game was accounting for the space between two tiles so the surface wasn't leveled.
Your answer
Follow this Question
Related Questions
Moving an object with a collider in 2d? 1 Answer
How do I prevent characters from being able to land on each others heads? 1 Answer
2D player keeps getting dragged to the left for some reason. 0 Answers
2D Top-Down Movement: Transform.up and right don't change 2 Answers
How to I get my 2d gameobject to move towards another gameobject when it is clicked? 0 Answers