- Home /
Top down movement not working?
,i am making top down game and i just finished my character controller, BUT......, for some reason instead of moving smoothly he snaps to a position depending on what key you press. E.G. i press the W key and have a speed of 5, he moves a tiny amount and no further. if i increase the speed he will move further away from the original position, but still no further.
the controller i am using is;
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class CharacterController2D : MonoBehaviour { public float Speed; public Rigidbody2D rb;
Vector2 Movement;
void Update()
{
Movement.x = Input.GetAxisRaw("Horizontal");
Movement.y = Input.GetAxisRaw("Vertical");
}
void FixedUpdate()
{
rb.MovePosition(rb.velocity + Movement * Speed * Time.fixedDeltaTime);
}
}
heres a vid if that was confusing
Your answer
Follow this Question
Related Questions
3rd person controller in c#? 1 Answer
Character controller air control 0 Answers
Early FPS Style Character Controller (No mouse) 0 Answers
Character controller slide 0 Answers