- Home /
Switching between gun positions
In unity, i have my MP7 model, and i have an animation which can bring the stock out, and put the stock back in, what i am wondering is, how would i press a button to play "StockOut" animation, and keep the stock out instead of it going back to the idle animation which has the stock back in. If this is a bit confusing, ill try to explain it better. It's just changing the position of the stock VIA animation. I dont want a script, but i just want to know how to do it, im thinking of using a bool, but thats as far as my scripting knowlege goes.
Thank-You
-Parzivell
Answer by ForeignGod · May 10, 2014 at 02:01 AM
Try to create another animation which is f.ex: IdleStockOut, change your script from going to your "Idle" animation to "IdleStockOut". Im really bad in animations but i think this logic should work.
If you want a button press to do something you need some scripts, but its really simple.
if(Input.GetMouseButtonDown(0))
animation.Play("StockOut");
animation.PlayQueued("IdleStockOut", QueueMode.CompleteOthers);
Make sure the idles are loopes, which you probably are already aware of.
Also, as for the scripts mentioned earlier, i guess you could just use Mechanim to minimize the script usage to your preferences. I have little knowledge on mechanim so i guess you should experiment a bit.
Your answer
Follow this Question
Related Questions
problem with weapon animation -.- 0 Answers
animations or code? 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Photon Multiplayer Animations 2 Answers
gun bob and jerk animation 2 Answers