Forum rules - please read before posting.

Legacy characters and head tracking

Good afternoon folks,

I was wondering if its possible to setup a legacy based character for head tracking> I have a non-humanoid baddie who needs to look at the player.

I began setting it up as I would any other Mecanim characters, defined the neck bone and setup IK Pass on the animation controller base layer, and have it looking at the player camera. I then realsied it dosent work for legacy based characters.

Is there a way to do this?

Any help, as always, is much appreciated. 

Best,
Tim

Comments

  • Head-tracking is still possible for Legacy, though it's a little tricky to set up.  You basically have to create separate "look up / down / left / right" animations and assign them into the four fields that appear in the character's Inspector, as well as the Neck bone transform.

    Legacy is not the only option when the character isn't Humanoid, however - you can set their Rig type to Generic in the import Inspector and continue to use Mecanim.  IK head-turning won't be available, but again you can still have it by using custom animations.

    Mecanim-animated characters that have IK head-turning? disabled have two additional parameter fields: Head yaw float and Head pitch float.  If you map these to float parameters in your Animator controller, they will change according to how far the head is "supposed" to be turning.  For example, the yaw will go to -1 if they should be looking fully left, and +1 if right.  You'll need to make use of them manually - i.e. inserting animations (ideally a 2D blend tree) to animate the head accordingly.
  • That's fantastic @ChrisIceBox ! Thank you for the detailed answer, I had hunch it required the separate "look up / down / left / right" animations. I'll get started on hooking it up.

    Many thanks again,
    Tim
  • Hi again @ChrisIceBox,

    I decided to go with your suggestion and set the characters Rig type to Generic in the import Inspector.

    I added Head yaw float and Head pitch float and mapped them to float parameters in its Animator controller. I setup a 2D blend tree with the look up / down / left / right animations and suggested values for the head turn.

    image

    image

    The NPC script is set us as follows:
    image


    We're using the Character: Face object Action, and setting Face with 'to Head' and targeting the player.

    I've used the Tin Pot example to get setup the best I can, however we seem to get odd results. The tracing seems to snap from left to right then freeze.  One thing I did was to create the look up / down / left / right animations within unity and not from the 3D package. 

    Any help with what I'm doing wrong would be much appreciated :-)

    Best,
    Tim
  • edited October 2017
    Ths first thing to do will be to determine if the problem lies with the Animator, or with how AC is controlling it.

    Remove AC temporarily by going to a fresh scene and removing the AC components, and control the animations manually by changing the parameter values while the game runs.  Does it work as expected?
  • Hi @ChrisIceBox,

    Apologies for taking a while to get back to this thread. We eventually tracked down the problem with the character rig having - transforms on its joints on being exported out of Maya. We rebaked the animations and they seem to be working now. We also adding in a neutral position for the blend tree to get a smoother transition. 

    After all that though we decided to code the tracking as it just wasn't giving us precise tracking of the player.

    Thanks for all your help!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.