Hello all, I am fairly new to c# and am working on a Rigidbody character script, but am trying to find out how to make sure the player doesn’t speed up when going forward/backward and strafing at the same time.
What would I need to look into to fix this issue? Any and all help is welcome, I just need a point in the right direction to start studying more, thanks in advance!
void Update()
{
xInput = Input.GetAxis("Horizontal") * strafeSpeed;
yInput = Input.GetAxis("Vertical") * walkSpeed;
playerMovement = new Vector3(xInput, 0.0f, yInput);
}
void FixedUpdate() {
rb.velocity = new Vector3(playerMovement.x, rb.velocity.y, playerMovement.z);
}
}