playMaker

Author Topic: make npc's head bone/hands turn to face/reach to player if close enough?  (Read 2494 times)

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Every mecanim tutorial I see involves scripting for this stuff, but I just want a playmaker action that's like "turn head to face player".

look at can work for the eyes if they are independent models, but I am talking about something that affects the mecanim bones.

I also want to be able to say "the object the player is holding is desired by the npc, so reach the npc's hand up and follow the object.

this is something about inverse kinematics or something. I just don't know how to do this in playmaker.

it's the same, I think, as making npc arms touch walls instead of going through them, if close enough.

does anyone have any leads about how to do this with playmaker? I need to make a mecanim npc's face and hands follow a game object as it moves around the scene.

I hope I'm being clear enough about the problem.

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
I use FinalIK for this: https://www.assetstore.unity3d.com/en/#!/content/14290
It does a lot more though, maybe for only these things something simpler could work.

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
how does that work? would you write a playmaker script testing your distance to the npc each frame, and if you get within a certain distance, you set the ik target of the head to the main camera by using a set property action, with some 'reaction speed' variable?

and is there a way, by chance, to save and playback custom manipulations as animations? like, you hit play, do some stuff, and it saves it?

and am i right in thinking this would make it easy to use blender to create a custom hand rig (for vr) and allow the hands to grip different objects uniquely using different ik targets for the joints and fingers?
« Last Edit: July 09, 2017, 01:04:39 PM by westingtyler »

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
there is a learning curve to getting the rig setup right for IK, but yeah its pretty easy once you get the hang of it - at least for the stuff I've used, never done hand rigs for VR so that might be trickier

yeah, constantly check the distance and angle between player and NPC, and once the spot is right, you set the LookIK target and weight (there are playmaker actions for this) and it will follow the camera. "Reaction speed" would have to be you easing a float variable and using that as the weight

As far as I know you can't record the manipulations as animations, but you should ask the asset's dev that, maybe its a thing