Diagonal Movement Speed Boost Problem HELP
Hello guys, I have an FPSController script that I really like, it is super customizable and modular and everything works great. Except one thing, when you press two keys to move diagonally you are sped up quite noticeably. Now, I have heard you need to clamp or normalize that to fix it but when I did it, it messed up my jumping and now my jump is super wacky. It seemed like it fixed the diagonal issue kind of. It still kind of felt a little fast so I decided to jump on here for some help! Below is every part that I think could MAYBE be an issue thank you so much in advance guys! Also this is the original code without me trying to mess with it myself, and again this isn't all of the code just snippets, so if you guys think I should copy the whole code let me know. Thank you so much again - Braden OH AND ALSO i tired normalizing it and it is setting my input to both axis as .7 on x and .7 on y so adding that together is higher than the normalized standard of a magnitude of 1? Also I tried adding Time.DeltaTime and now I can't move left or right. Im a complete mess im sorry guys
public bool CanMove { get; private set; } = true;
private bool isSprinting => canSprint && Input.GetKey(sprintKey) && !Input.GetKey(KeyCode.S) && currentInput != Vector2.zero && !isCrouching;
private float GetCurrentOffset => isCrouching ? baseStepSpeed * crouchStepMultiplier : isSprinting ? baseStepSpeed * sprintStepMultiplier : baseStepSpeed;
private void HandleMovementInput()
currentInput = new Vector2((isCrouching ? crouchSpeed : isSprinting ? sprintSpeed : walkSpeed) * Input.GetAxis("Vertical"), (isCrouching ? crouchSpeed : isSprinting ? sprintSpeed : walkSpeed) * Input.GetAxis("Horizontal")); float moveDirectionY = moveDirection.y;
moveDirection = (transform.TransformDirection(Vector3.forward) * currentInput.x) + (transform.TransformDirection(Vector3.right) * currentInput.y);
moveDirection.y = moveDirectionY;
private void HandleJump() {
if (shouldJump)
{
moveDirection.y = jumpForce;
}
}
Your answer
Follow this Question
Related Questions
Diagonal character movement 0 Answers
Standard FPS Controller - Sounds Cancelling One Another 0 Answers
My player moves diagonally when you press two keys at once 0 Answers
Look Left or right but keep walking forward 0 Answers
Problem with mouse movement type input during the building project 0 Answers