- Home /
How do I make an aim down sight animation that can be used with mecanim?
I'm trying to animate a gun, and I can make every animation externally.. Except the aim down sights animation. I could use scripts or animate it in unity itself, which is what I just did, but it turns out it won't be compatible with mecanim. So I need to make all animations within my modelling program (3ds max), including the aim down sights animation.
Is there a technique or a way for me to make an aim down sights animation that will look right while seeing it through the fps controller's camera?
Answer by HacksPro · Jul 12, 2014 at 10:36 AM
If you want your camera to aim down the sights when you press the right mouse button follow these steps.
add your gun into the scene and make sure it looks good attached to the first person controller. Next add the gun into your fps camera. Next add this script into your gun :var Aim : boolean = false; var Cam : GameObject;
function Update () { if(Input.GetMouseButtonDown(1)){ Aim = true; if(Aim == true){ Cam.active = true; } }
if(Input.GetMouseButtonUp(1)){ Aim = true; if(Aim){ Cam.active = false; } } }
Next create a new camera and align it with the sights of your gun and make sure the camra is also added to the gun.
Next click on the gun and you should see the script the right of you screen, then add your newly created camera into the script where it says game object, and your done ! :D
Answer by HacksPro · Jul 12, 2014 at 10:35 AM
Here is a tutorial if my earlier comment wasn't that clear https://www.youtube.com/watch?v=osdLqFpVkec i take no credit for any of this .
Your answer
![](https://koobas.hobune.stream/wayback/20220613113848im_/https://answers.unity.com/themes/thub/images/avi.jpg)