run a part of a script from another script or simulate keypress
I have a script where if I hit the "F" key, I put away my gun and "F" again I draw my gun. Sounds pretty simple but there's a lot going on in turning off renderers and animations etc. Now....I want so when I approach a terminal ( triggerZone) I automatically stow my weapon - as if I hit the "F" key. So I would like to be able to code something like OnTriggerEnter pretend the F key was pressed - rather than duplicate that whole script changing from if (Input.GetKeyDown(KeyCode.F)) to OnTriggerEnter(Collider other) { {
Your answer
Follow this Question
Related Questions
Camera being affected by sphere collider triggers 0 Answers
Trigger a box collider based on force of an object 1 Answer
Falling Through Floor after a certain number of Triggers... 0 Answers
How do I make trigger destroy an object,with the collision from the player 1 Answer
How Do I increase speed based off of a trigger collider? 0 Answers