Movement (452408)

I have a movement script that seems to work pretty well, but I do have a couple of things that I would like to fix.

  • Crouching button (left ctrl) causes my movement script to make bing sounds when pressing to go left and backwards and wont move the person in that direction either. How do I fix that?

ps. the crouching isnt being used for anything yet so it is not in the script.

-How do I make it so that my character will slowly accelerate like a real human does. Example when you start to move or run it takes a second or two to get to your top(or normal) movement speed.

Current Script

var Speed = 5;
var moveDirection : Vector3;

function FixedUpdate () {

	if (Physics.Raycast(transform.position, -transform.up, 1)){
	var moveDirection = Vector3(Input.GetAxis("Horizontal")*Speed*Time.deltaTime, 0, Input.GetAxis("Vertical")*Speed*Time.deltaTime);
	}

transform.Translate(moveDirection);
}

bump

  1. Making crouch a toggle would fix the bing sound (seems to me this has something to do with either keyboard drivers or OS.)

  2. The input.getAxis(“Horizontal”) returns a value between -1 and 1 and is going there via acceleration. for example the value when not pressing anything is 0 and you start pressing left, it will go to -0.3, -.0.6, etc. Surely there is a modifier to intensify this.

The thing is I was to be able to hold the ctrl button and walk while crouched, and stand as soon as I let go… Why would ctrl+s or ctrl+a stop the player from going in the direction of back or left just because i press ctrl ? and when i press ctrl+s it makes a bing sound ?

how would I fix this ?

Probably because ctrl + a is a windows command… probably shifts focus from unity halting input. Also windows hates stuck keys so if you want to hold your key down to crouch…you’ll need to disable sticky keys in windows… otherwise windows will bing you a good one.

I have sticky keys turned off and I still get only forward to move forward when using crouch with ctrl. left and right with a and d wont move and backwards with s doesnt work +bings …

I tried the alternate (arrow keys) and it works fine, so I do know it is something just with a,s,d + ctrl