Question by
Trench_Man · Dec 29, 2019 at 09:11 PM ·
2d-platformer
My gravity seems slow, and don't know how to fix it
I'm working in 2D and my sprites aren't scaled large. My gravity seems much weaker and slower than it normally is.
using UnityEngine;
public class PlayerController : MonoBehaviour { public Rigidbody2D rb;
public Vector2 movement;
public float speed = 10f;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void Update()
{
movement = new Vector2(Input.GetAxis("Horizontal"), 0f);
}
void FixedUpdate()
{
PlayerMovement(movement);
}
void PlayerMovement(Vector2 direction)
{
rb.MovePosition((Vector2)transform.position + (direction * speed * Time.deltaTime));
}
}
Comment
Your answer