- Home /
2D PlayerMovement - Character falls slowly as soon as the movement script is active
Hey there! I wanted to create a little jump`n`run game, but while testing around with the player movement i found a problem i cannot solve.
I have a sprite with a texture, a rigidbody2d and a boxcollider2d. When my movementscript is not active the gravity behaves as expected, but when I activate it, my character falls with like half the speed.
This is a part of my script for the movement that should move the character:
void FixedUpdate () {
float x = Input.GetAxis("Horizontal") * Time.fixedDeltaTime * speed;
rb.MovePosition(rb.position + Vector2.right * x);
}
I have also tried different commands like rb.velocity, transform.Translate and more, but the problem was always the same.
Moving left or right works pretty fine but the problem is annoying for jumping
Hope anyone can solve this or explain what I am doing wrong, or link me another script for a simple movementscript.
Your answer
Follow this Question
Related Questions
I have this grounded script and it doesn't work 1 Answer
Newbie question about infinite runners 0 Answers
Hit/React Animation 2 Answers
OnTriggerEnter2D(Collider2D other) 2 Answers