#I'm trying to implement a run Mechanic but it no no work ;'(
1 messages · Page 1 of 1 (latest)
void Update()
{
var targetVector = new Vector3(_input.InputVector.x, 0, _input.InputVector.y);
//Move in the direction we are aiming
var movementVector = MoveTowardTarget(targetVector);
if(Input.GetKeyDown("left shift"))
speed = runSpeed * Time.deltaTime;
else
speed = moveSpeed * Time.deltaTime;
//Rotate in the direction we are traveling
RotateTowardMovementVector(movementVector);
if(!rotateTowardsMouse)
RotateTowardMovementVector(movementVector);
else
RotateTowardsMouseVector();
}
GetKeyDown will only be true for one single frame when you start pressing the button in question.
What you want, is GetKey.