Not sure why this dosen’t come up all the time…I want to animate with script & mecanim but not at same time.
Why is mecanim moving my object transforms to the first frame of one of my animations every frame when no animations are playing?
The only way to make mecanim do nothing seems to be switching off the component? I’d like to keep it switched on & ready to play animation when I want it to but the default behaviour here is just infuriating.
I do not have root motion ticked and there are not that many more settings to fiddle with - I hope Im missing something obvious, please help.
Sorry, but I’m confused by your use of Mecanim. As I understand it, mecanim works using Animator Controllers. So you put your animations into the Animator Controller, and then set up your parameters in the Animator Controller. In the Animator Controller, you will notice that the first animation you drop in will be orange. This is your default animation. If you want this animation to have no movement at all, then you could easily create an animation in Unity, and drag it in first as the default.
Hi medhue would be nice if mecamin behaved like that.
I’ve tried it with an empty state, with a blank animation & whatever I seem to do when I drag in the animation that alters transforms my objects get their position set every frame to the first frame of that animation when nothing is supposed to be playing. This behaviour seems…wrong to me any idea what could cause that?
Some images of your set up would go a long way to understanding your problem. And, if you want, we could skype and share screens, so I can see how you are trying to work it. I’m medhue1 on skype.
Ok heres some pics of a simplified version of the issue, first in edit mode you can see my camera script working properly & adjusting the persepective cameras Z position to match the ortho cams size:-
Now in play mode you can see mecanim altering the perspective cameras position when its playing an empty state, swtich off the animatior & normal service is resumed.
Ok, I looked at it, but I didn’t see what you said. What I saw on investigating, was that the empty has no animation assigned to it. Maybe that was just my scene tho.
hello again, thats correct there is no animation attached to the empty state yet mecanim is setting the position of the perspective camera every frame.
[quote]
If it has no animation, then it will use the position it last had.
[/quote] Could you explain what you mean here? Why would it do anything unless it was told to do something?
So what do I do if I specificly want it to do nothing? - Can I confirm with you that it was setting the perspective cameras position every frame when in the empty state & is this normal behaviour for mecanim?
I personally did not see a change in the position. What I would try, if I were you, is I would create an animation in Unity, drag it into the empty, and then select the camera, and go into the animation window. There, just hit record and set a keyframe. Then, you might want to select the animation in the project, and set it to looping. That should keep the camera where it is.
medhue, im not sure you understand the issue. Did you change the ortho size on the camera with the animator component? If you look at the cameras in the scene view & fiddle with the ortho size, then do the same in play mode you will see the problem i’m having. Thanks for taking the time btw And it would be good if i could just comfirm the behaviour shown in the pictures i posted.
Hello dantus, as far as i can tell yes i’m sure. The video shows that switching off the animator stops the perspective cameras position getting set by mecamin and correctly updated by the script.
I am just asking because the scripts could trigger the animator to do something. Did you try to disable the scripts and keep the Animator active? Does that change anything?
Another possibility you may try out is to change the size, but without selecting the actual game object. When you have a game object selected, it can have different behavior. Though, this would be a bug, but the information helps to isolate the issue.
When the scene is in play mode I cannot even move the perspective camera by draging it in the scene view. Disable the animator & i can - is this normal?