There's an asset called Look Animator and it does procedural head movement and allows any character to follow a target. To be able to have the character look at an object, I have to do it through code and I'm not quite sure..how.

I asked on the discord about the code needed and this is what they said.
You can do it in few ways, like SendMessage to game object with look animator attached, code:lookObject.SendMessage("SetLookTarget", transformToFollow);

You can use just code, when you have reference to LookAnimator component, like;
"public FIMSpace.FLook.FLookAnimator lookAnim;"

you can call in;
Start() "lookAnim.SetLookTarget(hereReferenceToObjectToLookAt);

Also, you can do the same with "public UnityEngine.Events.UnityEvent myEvent;" then dragging the object with LookAnimator inside the inspector, choosing "SetLookTarget" method from the list and dragging Transform you want to look at, then calling "yourEvent.Invoke();" at Start().
Code wise it's pretty clear, but I'm just not sure how to use it. Ideally, I'd like to be able to make it a node so I can make schematics. I think? Or would a plugin be better?
Currently making: Real-Time Diablo-like ARPG
  • You can also use a Send Message node or a Call Function node to do the job.

    E.g. using Send Message node:
    - function name: SetLookTarget
    - add parameter: enable
    - parameter type: Transform (based on what you posted)
    - game object: select the game object to follow
    - target object: select the game object that looks :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.