Using Mecanim

hello,

is it possible to make a (non-human) animated character turn head towards player position while playing its original motion ?

the T-REX walks, I want it to look at me while moving… I can’t figure out how to do, in a simple way! please do you have any idea ?
HOW does Animator.MatchTarget works ? is it the appropriate function ?

QUESTION 2: also is it possible to create/edit some basic animation directly in unity? like open/close the “jaw”,
how can I move “procedurally” the tail (maybe by using match target or something like IK and then use a moving target…?)


http://www.bobdo.fr/images/JP.jpg

Thanks a lot !!! :slight_smile:

okay maybe mecanim isn’t the right solution, just need some idea to animate the characters…
also I have different files @walk @run and I don’t remember how to use the different fbx anims in a single game object ?

Right now Mecanim Generic does not support IK or look-at functionality. But its always possible to look at the transforms in a LateUpdate and rotate them to match the direction you want. Or you can do a 2D blendtree that will allow you to control which direction the dinosaur is looking through the animator.

Having additional files with animations in them should be trivial.

yeah, thanks it works as you said, in script…
now I got T-rex looking at me, but there’s no constrains !!! I guess this is my real issue now, any advice to limit the rotation angles or Quaternions ? in angles the issue is that there’s nothing above 360 and nothing below 0°… that doesn’t help … I may try to use quaternions keep track of rotations over time then apply limits like someone wrote in these forums but I need some explanation on how to do this?!

ho, and thanks for answers, “U rock!” :sunglasses:

Well this is where it gets complicated fast. A good and simple way would be to project the problem into a horizontal plane, that will allow you to get a meaningful angle that you can decide how many neck bones needs to rotate how much. Once that is set you can use that direction together with the up vector to define a plane where you can determine the vertical rotation needed.