- Home /
Unity animation is off please help
I have 3 animations with my pistol; Run, Idle, Reload. Reload and Run work fine, but when I stop run and play Idle my gun moves somewhere else on the screen than where it should. It is not the animation since its the same X Y Z as the default position. If you look at the picture you will see the different animations, notice where the crosshair is, it is always in the center of the screen.
//Script that chances pistol from Run to Normal/Idle
function Update () {
if(Input.GetButtonUp("Run")) {
animation.Stop("run");
animation.Play("normal");
}
if(Input.GetButtonDown("Run")) {
animation.Play("run");
}
}
Check the transforms of all the pieces of your model. You may find there is one child object with a strange transform.
Dont forget a child object with 0,0,0 position will sit in the centre of the parent object.
I bet there is a child or grandchild object you are missing.
If I change the transform of any child of my pistol it will move and not be near my gun.
You need to check the transform of All the objects on the player. Ive noticed that things like colliders get moved when child objects have a not-close-to-zero transform. Is the camera on the player?
Your answer
![](https://koobas.hobune.stream/wayback/20220613115609im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
gun bob and jerk animation 2 Answers
Animation for weapon plays on game start instead of when i attack 2 Answers
Stop looping animation? 1 Answer
Play Specific Animations of an Object 1 Answer
Animation scripting problems 1 Answer