- Home /
How to use event.KeyCode
Trying to test out my controls here, but I keep getting weird error messages. This code is just to test to see if I'm doing it write, to see if when I press the x-button, and a character is under the object, they will send out a ray cast that will hit the object, and make it drop by -1000.
Here's my code:
var hit : RaycastHit; var keyCode : KeyCode;
function Update () {
if (EventType.KeyDown.X){ if (Physics.Raycast (transform.position, new Vector3(0,1,0), hit, 7) ){ if (hit.collider.gameObject.tag=="switch") { transform.position.y (gameObject.tag=="switch")==-1000;
}
}
}
}
Once I can figure out how to USE these things, then I can actually go about making scripts for my individual guys (I have two guys on the same screen) to make them work properly, EG: move using different sets of controls.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Issue with sprinting animation script 0 Answers
If, GetKeyDown, and Update() not working 2 Answers
How to play loop an audio clip on button hold down? 3 Answers
Why does this not work? Trying to use Keycode in variable. 1 Answer