- Home /
Animation interfears Player-Movement
Hello.
I got a lot of help from this site so thank you guys and I hope you can help me with my new Question too.
I'm setting up my Player. It's a human-like model with a basic armature with which you can control the whole mesh. It's just a test model because my real model wasn't that easy to set up and it was bugged.
I did only animate the arms to try stuff out. The animation is just the Model having his arms as it would hold a gun. When I then got into Unity and tried setting it up so that it can bend it's back and head with the help of the MouseLook-Script I faced a problem:
When I attach the Mouselook-script directly to the bones the animations play but the rotations of the bones are weird. The Mouse-Axes are inverted so for example if i mouve the mouse to the left and the right it bends and if I move it up and down it horizontally rotates.
A way to fix this is to child each bone to an empty gameobject which has the right rotation. The problem is that whenever I do this for any parent of the bones used in the test-animation the animation doesn't play anymore.
Is there any way to let the animation still play even when you destroy the prefab property of the armature ... or is there a way to fix the rotation-problem without blocking the animation by changing the hirarchy of the armature?
I hope someone can find an answer to this problem. If you need more information let me know and I will post it.
I'm hopefully gonna hear from one of you soon.
Best Regards,
Marius 'ExTheSea'
Update: I just tried to change the $$anonymous$$ouseLookScript So that if you choose $$anonymous$$ouseX it does what it would with $$anonymous$$ouseY and the other way around which does what it want for the bone right above the hibs when choosing mouseX(which uses $$anonymous$$ousY-Axis) and $$anonymous$$inX= -60, $$anonymous$$axX = 60.
The problem is that the bone above this one doesn't move at all with the same settings and the head bone which is above the last one rotates in the negative direction. So when I want to look up the head looks down.....
$$anonymous$$aybe this helped understanding my weird problem.
I found that the bones of the model in unity have weird rotation values. Has this to do with Unity reading bone-rotations or does it have to do with blender or the import? ...and is using relative angles the easiest way of solving this problem?
I'm asking because I don't know whether other things may break because of the weird rotation values and I would like to know if it comes from me importing the model in a "false" way so that the bone-rotation didn't get read properly or something.
... Or is there a way to don't break the animation even if parent some bones which aren't included in the animation to empty gameobjects?
I would appreciate every bit of help. Thank you in advance.
Regards.
Blender bones have 'roll' which imports into unity as a rotation around the bone's local-Y axis. I find it very helpful to set roll to zero for all bones - but you have to do that before you start animating, since animations rely on roll. There might be a converter to set roll and fix animations all at once, but I dunno.
The rotations don't really matter, though, unless you need to find them. But if you need the rotations, you can just child empty gameObjects to the bones you want to read - those gameObjects will have an 'at rest' rotation of Quaternion.identity.
I seem to have solved the problem with the bottom Back-Bone being rotate around 180 degree around. I just deleted the main bone and it worked. Now my only little problem is that I had to switch around x and y in my mouseLook script so that $$anonymous$$ousex controls the models y axis but that is a problem I can live with.
Answer by Loius · Oct 18, 2012 at 06:43 PM
You can rotate the bone itself in your modeling app so it's oriented the way you want, or
You can consider the bone's default rotation to be the identity, and alter your rotations accordingly (using Quaternion helper functions), or
You can rotate the bones according to the armature's parent object's local space, instead of the bone's local space
Hey,
Thanks for help but I don't quite get what you mean or better how to achieve this. Don't get me wrong I'm not really a newbie it's more that I don't quite understand what you mean.
I tried to manually adjust the bones themselves the problem is that the imported model has a z-rotation on the bone above the hibs of around 180. If I change this the upper body rotates around 180 degrees like expected and if I start the game the $$anonymous$$ouselook script still sets z to 0. So a approach of using relative angles sounds good.
2.Could you give me a bit of an idea how I would do this in more detail because my head currently can't think of a way to do it. It's tired :). So if you could give me an idea or a little snippet of an example code that would really help me.
Here I just don't understand what you mean, sorry. Expecially the part with the local space. The stuff from 2. applies here too :). If you could give me an idea/code to give my brain a little nudge.
Again Thanks for your answer I much aprreciate and I'm looking forward to your answer as I'm trying to solve this problem for quite a while now.
Regards,
$$anonymous$$ 'ExTheSea'
Btw. If you know like a modelling and setting up tutorial or something else that could help me please let me know because I start thinking I made a mistake when I rigged the model although I didn't really do anything that could cause this problem. Still, if you do know something let me know.
Sincerely,
ExTheSea