Hey all, been visiting the forums for a long time now. Pretty sure this is my first post though.
I’m having tons of fun working with the Animation system, but I feel like I might not be using it correctly, because I am having an issue that seems like it should be easier than I am making it out to be.
I am trying to animate my tank. Very simple. I want to move it forward a bit and back a bit, and of course a position in the middle. So 3 positions.
I have an Animation for Forward and for Back. They control transform position, as well as the rotation of the wheels, and even the scrolling of the tread texture. No problems with the animations themselves. And I have them as states in an Animator that runs them on Triggers. After running one, it immediately goes back to an Idle state that does nothing.
My problem is the start points for each of them. Because they go back to idle afterwards, the positions and rotations would all get reset at the end of the animation. I solved the position problem, by running a behaviour after the animation that would update the position of the parent to the position of my animated child (the animator is a child of a GameObject). Then when the animated child got reset back to zero (when it went back to Idle), it didn’t matter because the parent had moved to catch up with it. I later read that I could have avoided doing this by simply unchecking the Write Defaults checkbox on the Idle state. But doing that doesn’t help with the next problem, which is my reason for writing this up:
When the next animation starts (like I just ran the Forward animation, and now I want to run the backwards one). The start point of Backward is not the same as the last position of Forward. Again, the behaviour addresses fixing this position issue. But the wheel rotations and tank tread scroll are another story. I don’t know how to get them to retain their position after the animation. When I MoveForward, I rotate the wheel from 0 to 60deg. And when I MoveBackward, I rotate the wheel from 0 to -60deg. You can probably see my problem.
I feel like I am just missing something easy and am doing this wrong. I was hoping some of you guys can just slap me awake and tell me how easy this SHOULD be.
Thanks!