Hello,
I’m working on my first 2D side-scrolling game, I used several tutorials and tried several things but now I have a behaviour that I don’t understand. I have a tilemap, I added a Collider 2D, I dropped my player just above the floor with the collider.
My player has a “Box Collider 2D” and a “Rigidbody 2D” where I’ve set “Simulated”=“on”, “Use Auto Mass”=“off”, “Mass”=1 and “Gravity Scale”=1. It is not clear to me what those options do exactly.
When I hit play, the player.transform.y goes -1. The player moves with left and right but doesn’t jump. If I unset “Simulated”, player doesn’t drop -1 but doesn’t move left and right anymore.
To move the player around, I use:
Vector3 targetVelocity = new Vector2(_horizontalMovement, _verticalMovement);
rigidbody2D.velocity = Vector3.SmoothDamp(rb.velocity, targetVelocity, ref z, .05f);
if(isJumping)
{
rb.AddForce(new Vector2(0f, jumpForce));
isJumping = false;
}
Would you have any idea what can be the cause of this dropdown ?
Thanks.