Hi to all.
Hi all,
in first need to explain that im rly new in unity and have made some progress with designing and modeling and now im trying to do some simple stuff in scripting but where i get stuck is somekind simple for most of you so i decided to be a noob and ask :)
Anyhow.. I made some character and some weapon modeling, was watching some tutorials how fps is made and some tutorials are awesome and some of them are enigmatic for me :)
My QUESTION/NEED is an explanation how to make some some random key bindings for example : Crouch , Pick up item , Drop item , Fire , Aim down the sight. I made animations and used the FirstPersonController already but i cant find the way to make this (couse im noob at scripting) so i decided to ask for a help.
Hope you guys understand my question couse my english is not so brilliant :)
Any help will be welcome, and sorry 4 stupid questions :)
Tnx in advance
Answer by JedBeryll · Jan 12, 2016 at 10:47 PM
Setting up key bindings start here: http://docs.unity3d.com/Manual/class-InputManager.html (also it ends here). Basically you set up keys, name the keys to whatever you want, then use it in the game like this:
void Update () {
if (Input.GetKey("whatever")) {
//do stuff
}
}
There's a lot of documentation on this, look around in the Input class. http://docs.unity3d.com/ScriptReference/Input.GetAxis.html
Answer by shizOfreniak · Jan 13, 2016 at 12:19 AM
Thank you for fast reply...
Maybe im asking too much but can you give some bigger scripting code so i can test it and try to learn how it works couse this is little bit confusing.
For excample from beginning to end some simple script such as Fire button... I have some script writen by friend but it seems it does not work... And cant find some problem with it... Sorry once more for bothering but i better learn from excamples...
Your answer
Follow this Question
Related Questions
Destroy an INDIVIDUAL instantiated object 0 Answers
RayCast hitting Button and Item behind it 0 Answers
How do i Gizmos.drawLines in an order?? 2 Answers
OnCollisionEnter not running. 1 Answer
I Cant Jump? 0 Answers