Search Unity

【Look Animator】- Realistic look at target animation for your models!

Discussion in 'Assets and Asset Store' started by FimpossibleGames, Sep 28, 2018.

  1. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Look Animator is component which is animating bones of your character
    to create natural animation of looking at target object.
    There is many features to customize, special variables to make animation
    more smooth, multi-bone support working well with dynamic characters
    or with long necked creatures like dragon etc.

    > Link To Asset Store <

    > User Manual <


    Features:
    ● Includes interactive demo scenes
    ● Includes full source code
    ● Easy setup with enchanced inspector window
    ● Works with humanoid and animal skeletons
    ● Define how many bones you want use and animator gets them automatically
    ● One method to set "moment target" for component to focus on extra target for choosed amount of time
    ● Blend look animation with source animation
    ● Use "Bones' compensation" feature to prevent unnatural arms rotation when looking up or down
    ● Use "Animate with source" feature to keep whole animations motion, very helpful when you need to aim at target and play hit/shot animation, also using it during run or even idle animation makes it look more natural
    ● Turn off/on component with smooth transition by using one method
    ● Make look animation more soft with "Ultra Smoother" feature


    Release video:
     
    Last edited: Oct 2, 2018
    Willbkool_FPCS and DrOcto like this.
  2. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Package now is updated to V1.0.1
    - Fixed last back bone no weight error using Spread Value and upgraded it's formula
    - Added compensate positions option for bones compensation
    - Added Backbones rotation offset parameter in correction tab
    - Now when you exceed max rotation angle by clamping range it will highlight in red in the inspector window
    - Some minor upgrades in algorithm
    - Added "Prevent 180 Error" option now for testing, but later it will be probably default enabled option, but needs some more work for versatility
    - Added "Change Target Speed" option under "Limiting" tab, when your character is rotating head too fast or too slow when changing / loosing target you can adjust it here

    > Link To Asset Store <

    Also there is tutorial video for setting up dragon head:
     
  3. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    1,678
    Cool! I find that having characters move their heads as if they are looking at something is a simple but highly-effective way to make your character seem more alive.

    I've been using Unity's free head-look-controller script for my project so far. I've written some code on top of it to chose a look-at target based on the characters proximity to viable targets. The only problem I've been having is that when my code switches from has-target to has-no-target, the character's head immediately snaps back to animation's pose with no transition. I've been planning to attempt a work-around at some point, but it sounds like your system has already has a smooth transition for when this happens. Is that right?
     
  4. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Thanks :) Yes it have configurable smooth transitioning between targets and bunch of other options to play with ;)
    You can even change target gameObject from inspector window, giving possibility to use it with animated keyframed variables for cutscenes etc.
     
    Last edited: Oct 3, 2018
  5. hiroki1118

    hiroki1118

    Joined:
    Nov 22, 2017
    Posts:
    2
    Why can not I respond to mobile?
    The test on the PC is animating with accurate motion, but this script does not work when playing on the smartphone.
     
  6. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Strange, there should be no difference, I will check it, also try to update package, today was approved quick fix for some stuff. EDIT: (I think I know what caused this and it's fixed in update)
     
    Last edited: Oct 5, 2018
  7. hiroki1118

    hiroki1118

    Joined:
    Nov 22, 2017
    Posts:
    2
    thanks!
    It could also be used on the mobile platform.
    I appreciate your update.
    It is perfectly suited to the character of mixamo and I am satisfied
     
  8. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    1,678
    @FimpossibleGames, I bought the controller and I really like the way it automatically handles the problem that mentioned in my previous post. It's very smooth and natural.

    I'm having one problem, though. When a character looks down, with the default settings, it's doing this weird vulture-neck thing:

    upload_2018-10-15_12-35-14.png

    I can get rid of this by turning the backbones weight slider and the compensation weight sliders all the way down:
    upload_2018-10-15_12-38-27.png

    I feel like this is not how it's intended to work, though. Any ideas?
     
  9. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Hard to tell, probably something with axes setup on neck bones or maybe bone weights, but not likely.
    You can mail me mesh with skeleton (no need for animations) so I can investigate problem.
    But also you should try set some value for "Back bones add offset" under "Correcting rotations" tab, maybe it will be solution but not sure.
     
  10. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    1,678
    Thanks, I sent you the FBX file. In the meantime, I will try some of these other settings. I'm interested in fixing any problems with my blender rig, though, so that I can keep re-using it for other characters.

    Edit: Turns out this was just a problem with my blender rig. Thanks to FimpossibleGames for helping me find the issue.
     
    Last edited: Oct 17, 2018
    eaque likes this.
  11. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    585
    hi, Do you think it is compatible with THird person controller?
    thanks
     
  12. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Should be no problem ;)
    Only what you have additionaly to do is movement of main look target point from code or check how it's done in example scenes.
     
    Last edited: Oct 31, 2018
    eaque likes this.
  13. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    585
    sure!! Thanks!:)
     
  14. Dan-Gilbert

    Dan-Gilbert

    Joined:
    Dec 27, 2012
    Posts:
    6
    Hi, Ihave purchased Look Animation Asset. Setup is quite simple but i can not get my rig to look at the target . Instead it only looks away from target. ( see LRA anim Unity.jpg )

    Please see attached images one from Unity . Other showing local axes rotaions in Maya.
    I had to uncheck { Animate With Source } to stop random flipping /rotations

    I have tried lots of different setting in the Correcting Rotations settings.
    Im sure there is some offset config that will reverse the rotations .

    Also the target object has to be almost on top of the lead bone before any rotations .
    no matter if i try changing ditance 0 ( infinity ) to higher number . Still the same trigger distance .

    Many Thanks
     

    Attached Files:

  15. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Hi Dan, your skeleton looks correct, there is variable "Back Bones Add Offset" in "Correcting Rotations" which can do some stuff here but I think it will not solve whole problem, It's hard to tell what is going on for now, can you send me mesh file with skeleton on mail? Then I can check it precisely.

    If you don't have keyframes on neck bones then you toggle "Animate with source" off, but when you will have some animation here, it's good to turn it on then.

    EDIT:
    So problem here was forward axis of main game object pointing in reversed direction, fixing it solves the problem ;)
     
    Last edited: Dec 2, 2018
  16. eskapadero

    eskapadero

    Joined:
    Oct 25, 2017
    Posts:
    2
    Hi! Is there a function to change targets, or turn off look animation via click? Thanks.
     
  17. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Not sure what you mean by "via click" but you can check "FLookAnimator_Demo_TriggeredMomentTarget.cs" component which is changing target for LookAnimator when player game object enter trigger collider.

    You have methods like "SetLookTarget", "SetMomentLookTarget" and to turn off look animator you execute method SwitchLooking(false, timeInSeconds)
     
  18. eskapadero

    eskapadero

    Joined:
    Oct 25, 2017
    Posts:
    2
    I see..Thank you very much, I just purchased it yesterday so I haven't able to explore all the demos yet..Anyway, it is an excellent asset, fit for my game..:)
     
    FimpossibleGames likes this.
  19. aburian

    aburian

    Joined:
    Nov 29, 2018
    Posts:
    17
    Curious if this could be used in a boxing game to target the punching?
     
  20. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Just for head or to aim arm?
    If for head it could work with some additional controll on some variables through code in certain situations (but I am not totally sure)
    Arm aim could be more difficult but if you would like to use just spine bones to aim it could be easier.
     
  21. The-Creature-Queen

    The-Creature-Queen

    Joined:
    Jan 19, 2017
    Posts:
    24
    Hi, I can make any model or rig but I just can't program. However I'm great at playmaker! And when I say I can't program, the best I can do is paste a premade code to create a custom playmaker action.

    I know it's asking a bit for the price (hey I'm loyal and slowly buying everything that you make, lol!) but could you create a custom playmaker action downloadable on the ecosystem or scripts for me to paste to make them that do the following:
    -Set target character is looking at. (Will snap to an empty game object.)
    -Untarget what character is looking at.

    It only needs a game object slot to target on, that's it. I can work playmaker very very well to chose which target intelligently, I just..can't make the script do the thing.
     
  22. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    I'm not familiar with play maker, I would need to learn it a little but I planning to do it in future.
    But maybe it will be helpful so you can make playMaker action, you can try just changing variable like inside inspector,
    so lookAnimator.ObjectToFollow = YourTarget; and that's all ;)
    or use method lookAnimator.SetLookTarget(YourTarget);
     
  23. The-Creature-Queen

    The-Creature-Queen

    Joined:
    Jan 19, 2017
    Posts:
    24
    Thanks SO much for the fast reply! And for your kindness in explaining something so simple, yes I can use that with the playmaker's custom action template I think to create a custom action that uses the inspector. (Sorry I meant to buy this thing today as it's a must have, but my SO is the one with the card. lol) I'm chomping at the bit. If I get it to work fine, I'll post the link to download the custom actions so other people can use them with Playmaker.
     
    FimpossibleGames likes this.
  24. The-Creature-Queen

    The-Creature-Queen

    Joined:
    Jan 19, 2017
    Posts:
    24
    You were right, I didn't even need the custom actions, the inspector property was enough.

    For Playmaker people:
    https://goo.gl/AcVQMw

    Create an FSM on the moving character. Add 'set property.' Drag the look animator script down to the state and select 'Object to Follow' as the property to change. Use whatever means you like to change the target as needed. Works instantly.
     
  25. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Look Animator Update 1.0.6
    - Added support for simple eyes follow animation
    - New example model and example scene for LookAnimatorWithEyes component

    > Link to the Asset Store <

     
  26. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Look Animator Update 1.0.7
    Added "Bird Mode" under "Additional Control Parameters" tab.
    With this mode you can get Bird-Like laggy rotation and position animation.
    Feature probably will be polished in further updates.

    Griffon GIF

    > Link to the Asset Store <
     
    Last edited: Jan 22, 2019
  27. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    272
    @FimpossibleGames Is it possible to use this with the "Optimize Game Object" option in the Rig tab if we expose/keep the neck/back bones? I've tried doing so, but then I get this error:

    Code (CSharp):
    1.  
    2. Error during getting parents of LookTarget! (no parent?)
    3. UnityEngine.Debug:LogError(Object)
    4. FIMSpace.FLook.FLookAnimator:GetAdditionalBones(Boolean) (at Assets/FImpossible Games/Look Animator/FLookAnimator.cs:1633)
    5. FIMSpace.FLook.FLookAnimator:OnValidate() (at Assets/FImpossible Games/Look Animator/FLookAnimator.cs:1818)
    6. FIMSpace.FLook.FLookAnimator:UpdateForCustomInspector() (at Assets/FImpossible Games/Look Animator/FLookAnimator.cs:1837)
    7. FLookAnimator_Editor:OnInspectorGUI() (at Assets/FImpossible Games/Look Animator/Editor/FLookAnimator_Editor.cs:265)
    8. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    9.  
    10.  
     
  28. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    I researching but it seems it's not possible to animate bones through code with this option, we can only read the transforms with exposing. This optimization relies on removing possibility to do such things as animating through code.
     
  29. Monil

    Monil

    Joined:
    Apr 24, 2012
    Posts:
    13
    Hi,

    The Animator Component of my character use Animate Physics and I have some problems with FLookAnimator.

    Thanks for your help
     
  30. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Hi Monil,

    Thank you for support by buying my package.
    "Animate Physics" are using FixedUpdate() update order, you probably experience sudden changes in rotation etc?
    I am finishing feature to support this just by toggling one variable inside inspector.
    Contact me in PM or mail for update for you.
     
  31. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    89
    Hi. Great tool so far but running into an issue that I don't really get. Our characters have ears (generic skels) the ears are subs of the head. The head is setup as the lead bone. The ears have bones as well and animate etc. When the characters moves, rotates, looks around the ears are not following the head like before but seem to be lagging behind the head so they twist and warp. As you can see here. Including below this the other settings and skel setup for this character. Any idea how to fix this? Will post a five star review if we can get this working :)

    upload_2019-5-7_15-23-35.png

    upload_2019-5-7_15-25-11.png
     
  32. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    So for others: to check your skeleton correctness, you can select head bone in editor mode and rotate it / move, if head isn't moving or other things are moving but no head, that means the weights for bones are setted wrong.
    In this case you can correct it inside modelling software or use neck bone as lead bone.
     
  33. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    198
    Kinda got the same problem and i fixed it by adding multiple LookAnimators. The problem however is the activation of the lookAt. Because sometimes they are not synchronized. What i now did was creating a little handle script that also allows to switch the lookAt target. The thing i need now is a way to know if a lookAt limit is reached and the leading LookAnimator is activated.

    Is there something like a function state or variable that is for example true if lookAt is interpolating to synchonize all my animators? Something like:

    Code (CSharp):
    1. isLooking = true;
    ... would be cool. Iam currently using.
    using FIMSpace.FLook;

    Cheers.
     
  34. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    198
    So it seems
    Code (CSharp):
    1. EFHeadLookState lookState
    Is pretty much what I was looking for. Sadly its a protected variable, and I do not really want to change the animators code in case the asset gets updated. Is there a way to check if the animator is looking at things?
     
  35. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    You can change it to public, I added making this variable public for read in task list.
     
  36. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    198
    Yeah but then i need to do this every time the asset is updated. Would be cool to have a function inside the script that returns EFHeadLookState lookstates. :>

    There are probably some workarounds like for example checking for local bone rotation changes.

    I added this to the script with a little logic to be called every time the state changes. Would be very useful to have some sort of interface that is checking the look at script states.


    Code (CSharp):
    1.         public EFHeadLookState GetLookStateUpdate(EFHeadLookState Lookstate) {
    2.             return Lookstate;
    3.         }
    Cheers.
     
    FimpossibleGames likes this.
  37. vegasanx

    vegasanx

    Joined:
    Apr 7, 2019
    Posts:
    20
    Hi, when I want to get characters to stop looking at something I set ObjectToFollow to null. They they look somewhere off to the left (or right) before returning to default position. Why is this?
     
  38. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    I think I noticed something like this lately but couldn't accurately reproduce it.
    I will dig it more in next days to make fix for it.
     
    vegasanx likes this.
  39. vegasanx

    vegasanx

    Joined:
    Apr 7, 2019
    Posts:
    20
    Thanks! I'll keep a look out for that fix then.
     
  40. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    198

    Also had a similar problem. But when switched targets.

    I kinda workaround the issue by interpolating to a blend value of 1 which basically has the same effect as setting a look target of null.

    Code (CSharp):
    1.     IEnumerator ExitSmoothLook() {
    2.  
    3.         for (float f = 0f; f <= 1f; f += 0.01f)
    4.         {
    5.             LookComponents [0].BlendToOriginal =  0.1f + f*(f-0.1f);
    6.             LookComponents [1].BlendToOriginal =  0.7f + f*(f-0.7f);
    7.             LookComponents [2].BlendToOriginal =  0.3f + f*(f-0.3f);
    8.             LookComponents [3].BlendToOriginal =  0.3f + f*(f-0.3f);
    9.  
    10.         }
    11.         SetLookAtTarget (target);
    12.         yield return null;
    13.  
    14.     }
    In this example i got a complex rig with multiple lookComponents that all have different BlendToOriginal target values that i want to reach at a time the for loop is finished. This way its possible to synchronize all 4 look at components, which was important in my case. (My rig has creatures with long necks and multiple muscle strands that are outside the neck hierarchy.)

    After interpolation is done. The Target will changed or set to null. This way you can prevent the sudden jerking.
     
    Last edited: May 18, 2019
  41. vegasanx

    vegasanx

    Joined:
    Apr 7, 2019
    Posts:
    20
    Oh thanks but FimpossibleGames PMed me the fix.
     
  42. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Fix also will be included in version 1.0.9 which will be available soon
     
    vegasanx likes this.
  43. ProtoPottyGames

    ProtoPottyGames

    Joined:
    Dec 18, 2015
    Posts:
    44
    Hi.
    Just had one more quick thing regarding this one..hehe

    I would like to request that you pleeeease very much NOT do away with the "Prevent 180 Error checkbox" as I very much need to keep that unchecked for several of my use cases. Thank you for your consideration. :)
     
  44. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    I'm not sure what you mean :( Can you precise it a bit more?

    Updated to V1.0.9:
    - Fixed animation of going back to default pose when target was changed to null or in other situations
    - Added toggle "Animate Physics" (optional parameters tab) to support "Animate Physics" option in Unity's Animator
    - Added new demo example component for focusing on target object within trigger area, with queue feature
     
  45. ProtoPottyGames

    ProtoPottyGames

    Joined:
    Dec 18, 2015
    Posts:
    44
    Sure. :)
    There's a checkbox with a tool tip on it saying something about how the 180° correction thingy may end up being a standard or removed or something instead of a toggle. Just thought I'd chime in about it's usefulness to me before it dissapers or something. ​
     
  46. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    304
    Hi,

    Can you change the target automatically and for example the npc will look at the player then at another npc but will prioritize player or the one that is closer?
     
  47. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    You can do some custom coding for it, here small example how you can do it: https://pastebin.com/30tbWPJy
    But I am working on update where I will include more elegant example of behaviour you suggested ;)
     
    skinwalker likes this.
  48. FimpossibleGames

    FimpossibleGames

    Joined:
    Jun 27, 2018
    Posts:
    151
    Updated to version 1.0.91:
    - Some code factoring, new mothods like "TryFindHeadPositionInTarget()" or "GetCurrentTarget()"
    - Few fixes inside inspector windows
    - New example for NPCs prioritizing player's presence to look at
    - New example for gun aiming type of look at animation

     
    ProtoPottyGames and skinwalker like this.
  49. ProtoPottyGames

    ProtoPottyGames

    Joined:
    Dec 18, 2015
    Posts:
    44
    Excellent.....now I can rip out my ugly solution for prioritizing LookAt.
     
  50. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    198
    Awesome stuff.