Changing position of GameObject with Animation

Hello,

I am having problem with dynamic change of GameObject position (e.g. transform.position,…) which has attached animation(s) to it. It doesn´t do anything.

It seems like the existing animation(s) override my commands for position change, even if these animations are not being played.

Once I delete all existing animations of the GameObject, I can change its position again as expected.

Is this behaviour to be expected? How do I get around it?

Thank you all for your thoughts!

George

Hi George,

I had a similar problem myself, so to get around it I had an empty GameObject as a mounting point, and the animated object as a child set to 0,0,0. When moving the object with transform.position, I would use myGameObject.transform.parent.transform.position - this would move the mounting point while leaving the child at 0,0,0.