I am using a controller in my game but when I move the stick it only moves my character a tiny bit!?

Here is my code.

PlayerControls controls;

Vector2 move;

void Awake()
{
    controls = new PlayerControls();

    controls.Gameplay.Move.performed += ctx => move = ctx.ReadValue<Vector2>();
    controls.Gameplay.Move.canceled += ctx => move = Vector2.zero;
}

void Update()
{
    Vector2 m = new Vector2(move.x, move.y = 0.8f) * Time.deltaTime;
    transform.Translate(m, Space.World);
}

void OnEnable()
{
    controls.Gameplay.Enable();
}

void OnDisable()
{
    controls.Gameplay.Disable();
}

I have also attached a video.

1 Answer

1

Use a speed (like 5.0f) and multiply m by speed.
Time.deltaTime is a very tiny float (at 60 FPS , about 1/60 ~ 0,0166667.

@jmhoubre Thank you so much! I did have to change the title of the game to Hoppy Cube from Blocky because the cube kept hopping but I like it more this way.