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