Snappy movement, not smooth movement (turning)

Hi all,

I know the title is kinda confusing but here is the situation. I currently have a a character that just moves on the x axis left and right. Good. Now, the problem is that when I change directions, the change isn’t instant. It does a speed up first. I.E., the movement is very smooth. I basically want the movement to be instant when I change directions like those seen in SHMUP games.

Here is my current movement code:

function Update () 
{
	var horizontalMovement = Input.GetAxis("Horizontal") * speed * Time.deltaTime;
	
	var newPos = rigidbody.position + Vector3(horizontalMovement, 0, 0);
	
	rigidbody.MovePosition(newPos);
	
	//Horizontal movement border
	var pos : Vector3 = transform.position;
	
	pos.x = Mathf.Clamp(pos.x + horizontalMovement, -9, 9);
	
	transform.position = pos;
}

I think that’s all the related code. Anywhos, I hope someone can help me with this because my game is similar to a SHMUP where it needs that snappy movement.

Thanks

In the Input manager (Edit->Project Settings->Input) find the horizontal axis and increase the Sensitivity to a high setting.

Oh cool thanks. That seemed to have fixed it after I made the sensitivity from 3 to 100.

But I just noticed that when I let go of the keys, my character does a slight “slowing down”. Anyway to fix this? I mean yeah, I basically want the type of controls you see in SHMUP games.

Thanks

Alternatively, try using Input.GetAxisRaw( “Horizontal” ), instead of GetAxis(…)

1 Like

Snap didn’t seem to affect anything but I did find out that increasing gravity fixed my problem, which kinda makes sense when you think about it facepalm.

Thanks for the help =D