Animation system wont work + avatar issues
Hello!
I've been recently working on a game, using cube-made characters (meaning that every character is made of separate cubes, those made in unity, not in blender). I have quite a lot of problems while working with the animation system that way thought. Mecanim won't work for me, neither does old-ass legacy animation system. This is the way my character looks like:
Mecanim: After hours of research, still can't figure it out: how can I make an avatar of that character I made. It simply won't work. So: I attached an animator component to the player game object, made an animator with transitions and a clear state that has a transition from "Any state". As parameters from the new state to the 'walk' state, the parameters consisted in a velocity (float) one, accesed from script as well,
anim.SetFloat("velocity", speed);
, where the speed float is a float that gets a value whether you hold (or not) the ctrl button. In the transition the parameter was "velocity Greater than 1", and even if you wouldn't hold the ctrl button you'd still get 2.88f value. Tried to use a SetFloat of 1f, so I could see if does it acces it: it does not. I think it would be solved if I'd have an avatar. So, in my case, how can I create an avatar?Animation (Legacy): From debug mode, set the animation type to legacy, then accessed from script; went well, but when the component (animation one, without having an animator) it goes up in the sky. I have to point on the fact my player has a walker script that directly acceses character controller: tell me if is that the issue.
Hopefully you could help me out! Paul
@meat5000 There you go: I'm using this script, alongside with the character controller as a walker script. This is the inspector: (point out that it happens the same both when I have animation accessed from script and when I do not)
Tell me if do you need any more informations. I'm stuck with the animation system, I have just switched from 2d animations to 3d ones...
Did you try it with the Animator component and a State $$anonymous$$achine? Rather than using "Animation" component?
With Character Controller in conjunction with Animation it is often required to perform extra rotations inside the LateUpdate() function.
As you can see from those images, it kinda works (it set the float, yet the animation is not playing...).
I keep trying and trying other and other possibilities and searching on the internet, yet nothing helps me...sorry if I overcharge you with my stupid questions but it's a no-go situation for me. @meat5000
And thanks for trying to solve my problem, we're getting closer and closer (I guess :D )
EDIT: it works, but I get those errors, even if at the moment I made it so that it only runs when I run from script...It gets laggy and all this stuff.
Answer by meat5000 · Mar 31, 2016 at 12:31 PM
Mecanim Avatars require Rigged models. They must have bones. The bones determine the vertex movement.
Rigged models usually require a proper parenting structure. I see all your model parts are simply a child of the main player object. This wont work.
You can animate your model using the Animation window which can perform Transform manipulation and as far as I know is the only way to animate with Mecanim without a bone structure. This is animation by curves and does not require an avatar.
Well, but what is my problem all about? (the one with the animation system) Why does it bug like that? When I have the animation system unchecked, character's control script is working and it all works fine. When I check the animation component, it gets stuck at a random Y...
And about the $$anonymous$$ecanim, how can I parent it "properly"?
You will need to add more info. Like your Animation Controller Script and your statemachine/player Inspector screenshots.
Your answer
Follow this Question
Related Questions
Animation Legacy behavior -> Mecanim animation 1 Answer
Mecanim state that keeps last pose? 0 Answers
Problems with using the same Animator Controller on multiple objects. 0 Answers
New Unity UI System animation question... 0 Answers
is it possible to convert generic animations to humanoid ones? 1 Answer