Forum rules - please read before posting.

Mechanim Parameters

edited August 2015 in Technical Q&A
Hi!

First Person game, using character model, not a capsule (like in 1st person tutorial)

Ive used a body mask on an animation of an NPCs mouth moving, and chosen the Mechanim paremeter in the player script, and it works flawlessly.

However, now I want my Player to be able to carry a torch, just like the sword example in the demo. After  a few hiccups, (I didnt realise the object has to exist in the scene, mine is being selected IN THE inventory.) No problem I hid the object (the torch) at 0,0,0, and now it pops into the Player hand just fine.

However, because the character is animated, either in Idle OR walking, the hand holding the torch wanders all over the place. no good for a torch.
I want a TYPICAL 1st person view here, with the arm showing as you walk.
So I thought, what about triggering an animation (no actual animation you understand, just the arm position moved to the right point. Made new layer with a Body Mask,  in the Mechanim window, but then... in the player setting there is no Mechanim Parameter for ARM... just turn talk head yaw head pitch vertical movement and jump.

How can I do this another way? basically FREEZING the arm so the torch shines where you walk? 

MArk

Comments

  • Hi Mark,

    I recommend you to check Final IK asset for Unity and in concrete Interaction examples. You can reuse your idle-walk-run animations while changing an arm to hold the torch.
  • Thanks for suggestion, but Waaaay too expensive for me I'm afraid.
    Anything simpler... I NEARLY have it with the method I suggested, Id like an explanation of what the mechanim parameters panel in the player/NPC script actually does...
    Do I even need it when I have the action Character/animate - Method change parameter values?

    Its not working right but that might be some other Unity reason, like the body mask or what not...
  • The Mecanim parameter names you define in the Player / NPC components are used to tell AC what it is "allowed" to change when your game plays.  For example, filling in the movement speed float parameter field tells AC that it can send the character's movement speed to that paramater.

    AC won't do anything beyond changing those core parameters unless you tell it to (e.g. by using Character: Animate), meaning you can use as many or as few of them as you like, and wire up your Mecanim controller however you want.

    You don't need to have the torch item hiding in the scene - you can use the Object: Add or remove Action to add it in mid-game.
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.