- Home /
Question by
JonnyCode · Aug 11, 2011 at 09:31 PM ·
c#first-person-controller
First person Controller auto movement
What I'm looking to do is that once the player presses a designated key, the first person controller will move forward a certain amount (think of Halo:Reach's Evade ability). Right now, what I have only works if the player is pressing a movement key down (and holding it down). Any help that's available is appreciated. Here is what I have:
if (Input.GetButtonUp("Evade"))
{
Evade = true;
moveDirection = new Vector3(Input.GetAxis("Horizontal")*EvadeSpeed, 0, Input.GetAxis("Vertical")*EvadeSpeed);
PlayerController.Move(moveDirection.normalized * Time.deltaTime * EvadeDistance);
Evade = false;
}
Comment
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
C# Crouch script problem 1 Answer
Most efficient way to check distance between player and scene objects 4 Answers