Incorrect start position for Animation

I created an animation fallowing the course and the animation starts at the parent position instead of ending at the parent position. When I play the animation in the animation window everything works great but when I start the game the animation ends at the ends below the parent. I’m using Unity 5.5 for it.

Screenshot of end animation

I didn’t see any option to change where the animation starts or ends. Anyone has any ideas?

1 Like

In order to edit an animation, you need to put in the Hierarchy the prefab that contains the relative Animator.

So put one instance of the Enemy Ship prefab, check the transform.position of the Animation and be sure that the final key frame has a zero in all 3 directions.

1 Like

I made sure that the positions at the last key frame in the animation are at 0 in all 3 directions and on the animation preview it looks fine. As shown on the image below:

1 Like

The position shown in the Inspector in your pic is the object’s one (not in red and Record button disabled), to show the final frame position you need to activate the Record mode of the Animation (the object’s transform in the Inspector will become red), or alternatively expand the transform position propriety in the Animator.

1 Like

The transform is the same when i edit the animation.Maybe video will better show the problem.

1 Like

The Animation clip seems fine. Disable Apply Root Animation in the Animator component btw, and if it doesn’t fix the problem, please post your EnemyBehaviour script.

1 Like

When I disable root motion in the animator the objects start dancing :slight_smile:. Video in the link below.

You can also see the EnemyBehaviour script below:

http://pastebin.com/HQM11iyS

1 Like

Ok, the script doesn’t touch at all the transform of the object, so there must be something wrong in the Animator and/or the spawning Animation. Notice that when you disabled the Root anim., after reaching the final position in the formation, all the ships started to loop between the correct position in the gizmo and a lower-right point relative to the gizmo.

You should check if all the animations you’re using have the Loop flag disabled.

It would help if you would post a screenshot of the Animator, the relative transitions and the Animations.

1 Like

Thanks to your help I manged to resolve the problem I had transform in idle animation and the idle animation was looping. So in short turning off the root motion and removing transform from idle fixed the problem.

Thanks a lot Galandil. You helped me tremendously and I really appreciate it :slight_smile:

Have wonderful life.

1 Like

Glad being of help. :slight_smile:

1 Like

this was helpful, I had the dancing issue as well and found my animation was set to loop as well, Thanks!

1 Like

Privacy & Terms