- Home /
When my character walks left and right on a tile map, the value of rb.velocity.y is often not zero.
I'm developing side scrolling game using a tile map. RigidBody2D's Velocity.y value is 0 when moving from right or left, so the jump animation is not activated.
if ((rb.velocity.y < 0.1 ) && (rb.velocity.y > -0.1))
// if (((rb.velocity.y < 0.1) && (rb.velocity.y > -0.1)) || raycastHit.collider != null)
{
anim.SetBool("isJump", false);
anim.SetBool("isFall", false);
}
When my character walk unexpectedly over the tilemap, the value of rb.velocity.y may go up. This results in a jump animation that moves from side to side.
I searched for it to check Used by Composite in Tilemap collider 2D and add Composite Collider 2D. RigidBody2D was automatically attached and I set the body type to static. So when main character walk from side to side on the flat land, the value rb.velocity.y = 7.643655E-09 keep appears, so the run animation is not working.
Or how can I solve it?
Your answer
Follow this Question
Related Questions
Rigidbody2D velocity changes when moving through a platform collider. 1 Answer
tilemap collision not working with sprite 2 Answers
How can I disable collision for 1 tile? 4 Answers
2D tilemap building game top-down,2D TopDown Building game with tilemap 0 Answers
How can I find the name of the tile that I collided with in 2d? 1 Answer