Search Unity

Motion Controller

Discussion in 'Assets and Asset Store' started by Tryz, Feb 21, 2014.

  1. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    771
    You can add animation events and edit the animation import settings on an animation clip by selecting the clip within the list on the Animation tab of the .fbx file that it belongs to:

    upload_2019-5-13_9-32-11.png

    upload_2019-5-13_9-33-29.png


    If you simply select the animation clip in the Project Hierarchy, you won't be able to edit any of its properties in the inspector:

    upload_2019-5-13_9-34-36.png

    (Clicking the Edit button will take you to that clip's entry in its parent file's Animations tab)

    Is this what you mean? :)
     
    Tryz likes this.
  2. Dermestes

    Dermestes

    Joined:
    Aug 9, 2015
    Posts:
    9
    Thanks, TeagansDad. I was trying on the Animation window where everything was grayed out and that seems to work for me.
     
  3. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    214
    Hello everyone. i have created a simple but very powerfull spell action for those of you who have that. it is basically a test to see if a combatant has a target locked that way you can use that target to cast your spell :) Which is pretty handy for both NPC's and PC's

    Code (CSharp):
    1. [Serializable]
    2. [BaseName("Test Target locked")]
    3. [BaseDescription("Check if combatant has a target")]
    4. public class TestTargetLocked : SpellAction
    5. {
    6.     /// <summary>
    7.     /// Determines who we'll activate the motions on
    8.     /// </summary>
    9.     public int _TargetTypeIndex = 0;
    10.  
    11.     public int TargetTypeIndex
    12.     {
    13.         get { return _TargetTypeIndex; }
    14.         set { _TargetTypeIndex = value; }
    15.     }
    16.  
    17.  
    18.     /// <summary>
    19.     /// Used to initialize any actions prior to them being activated
    20.     /// </summary>
    21.     public override void Awake()
    22.     {
    23.         base.Awake();
    24.         _DeactivationIndex = EnumSpellActionDeactivation.IMMEDIATELY;
    25.     }
    26.  
    27.     /// <summary>
    28.     /// Called when the action is first activated
    29.     /// <param name="rPreviousSpellActionState">State of the action prior to this one activating</param>
    30.     public override void Activate(int rPreviousSpellActionState = -1, object rData = null)
    31.     {
    32.         base.Activate(rPreviousSpellActionState, rData);
    33.  
    34.         // Determines if the test is valid
    35.         bool lIsValid = false;
    36.  
    37.         // Grab the target and test it
    38.         GameObject lTarget = GetBestTarget(TargetTypeIndex, rData, _Spell.Data);
    39.         if (lTarget != null)
    40.         {
    41.             lIsValid = ActivateInstance(lTarget);
    42.         }
    43.  
    44.         // Immediately deactivate
    45.         if (lIsValid)
    46.         {
    47.             OnSuccess();
    48.         }
    49.         else
    50.         {
    51.             OnFailure();
    52.         }
    53.     }
    54.  
    55.     /// <summary>
    56.     /// Activates the action on a single target
    57.     /// </summary>
    58.     /// <param name="rTarget">Target to activate on</param>
    59.     protected bool ActivateInstance(GameObject rTarget)
    60.     {
    61.         if (rTarget == null)
    62.         {
    63.             return false;
    64.         }
    65.  
    66.         Combatant c = rTarget.gameObject.GetComponent<Combatant>();
    67.         if (c.Target != null)
    68.         {
    69.             return true;
    70.         }
    71.  
    72.         return false;
    73.     }
    74.  
    75.  
    76.     #region Editor Functions
    77.  
    78. #if UNITY_EDITOR
    79.  
    80.     /// <summary>
    81.     /// Called when the inspector needs to draw
    82.     /// </summary>
    83.     public override bool OnInspectorGUI(UnityEngine.Object rTarget)
    84.     {
    85.         bool lIsDirty = base.OnInspectorGUI(rTarget);
    86.  
    87.         NodeEditorStyle.DrawLine(NodeEditorStyle.LineBlue);
    88.  
    89.         if (EditorHelper.PopUpField("Target Type", "Determines the target(s) we'll do the test on.", TargetTypeIndex,
    90.             ActivateMotion.GetBestTargetTypes, rTarget))
    91.         {
    92.             lIsDirty = true;
    93.             TargetTypeIndex = EditorHelper.FieldIntValue;
    94.         }
    95.  
    96.         return lIsDirty;
    97.     }
    98.  
    99. #endif
    100.  
    101.     #endregion
    102. }
     
  4. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    That's awesome. Thank you for sharing.
     
  5. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    284
    @Tryz Having a little issue with my Camera Controller. I followed one of your short videos to setup an Adventure Style character, nice and easy, thx. The player turned to face the camera when I hit back all was good. But when I imported the Shooter Pack, all I could get was the 3rd Person Camera. I could not get the Adventure Style camera.
    Help?
     
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Hey @jnbbender ,

    All of this really depends on how you have your motions setup, but the Shooter Motion Pack was built to have the character face the direction of the camera while aiming and shooting. This is standard for games like Rainbow Six... otherwise the character would face the screen and shoot. ;)

    However, you can control this. For example, in the demo_Shooter I use the Basic Walk Run Strafe motion for movement. That has the character always face the direction of the camera (forward).

    You can change this to allow an adventure style by doing the following:
    1. Open my demo_Shooter demo
    2. Remove the Orbit Rig from the Camera Rig GameObject
    3. Add the Camera Controller to the Camera Rig GameObject
    4. Press the 3rd Person Style on the Camera Controller
    5. On the Player Game Object, enable the Basic Walk Run Pivot motion (for adventure style)
    6. On Basic Walk Run Strafe motion, set the "Valid Actor Stances" to 15.

    This is the stance that the character goes into when the gun is equipped (you see that on the Basic Inventory "Rifle" Weapon Set... "Stance = 15").

    What this does is it allows your character to move in adventure style when a gun is not equipped. Once they equip the gun, their stance changes to 15 and now they go into strafing movement style. Put the gun away and the character can face the camera again. To me, this made sense when shooting guns.

    You can do some thing to always allow the character to face the camera. For example, just disable the Basic Walk Run Strafe motion. However, when shooting and aiming it will conflict with shooting trying to go down the direction of the camera. I haven't tried to allow the player to face the camera and shoot. It might be possible by changing some settings, but it's something you'd have to play with.
     
  7. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    284
    Fantastic, just what I wanted to do. Thanks
     
    Tryz likes this.
  8. Hypester

    Hypester

    Joined:
    Jan 23, 2018
    Posts:
    17
    Hey, I was going through these video tutorials, like this one:

    And, I can't find anything called 'Basic Memories' did that ever actually get added? Is there something else that serves as an alternative?
     
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    That was some for-fun work I was doing a while back. Due to time issues, I never finished it. Memories, factions, etc. are not part of the Motion Controller.
     
    antoripa and TeagansDad like this.
  10. Hypester

    Hypester

    Joined:
    Jan 23, 2018
    Posts:
    17
    Cool, thank you for the response, still an incredible controller, even if it's not a full game system
     
    Tryz and TeagansDad like this.
  11. ade72

    ade72

    Joined:
    Mar 20, 2019
    Posts:
    8
    Hi,
    just bought Motion Controller, and I am deeply impressed. Thank you for this great piece of work.
    One thing I cannot handle: Motion Controller uses Unity Standard Input Controller, and though I can "run" by pressing SHIFT and W at the same time, nothing happens if I want to change the direction while running; e.g. if I hold W pressed going forward and then press A while holding W, nothing happens.... is it the way it should be? Thanks in advance!
     
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Hi @tomaro it sounds like you might not have pressed the 'setup input entries' button on the MC inspector. That adds 'Run' to the Unity Input Manager and ties it to shift. If you do that in my 'demo Terrain' demo for example, it all works.
     
  13. ade72

    ade72

    Joined:
    Mar 20, 2019
    Posts:
    8
    Hi Tryz, thank you for the fast respond. You are right, if I try the demo Terrain, it works. That calms me down, because I was afraid that it might be a hardware issue with my keyboard. But: I cannot find that setup input entries button in the MC inspector. I cannot find it when using standard unity input source nor using your easy input controller....

    I CAN run by using SHIFT+W,
    I CANNOT e.g. walk by pressing W + A at the same time.
     
  14. ade72

    ade72

    Joined:
    Mar 20, 2019
    Posts:
    8
    Oh, I found a solution. When I select Adventure Style instead of MMO Style, it works! :)
    Is it the way it shall be at MMO style? Thank you!
     
  15. ade72

    ade72

    Joined:
    Mar 20, 2019
    Posts:
    8
    Now another strange behaviour (let´s call it unexpected behaviour): When I use adventure style, the pressing of two keys at the same time, e.g. forward and left (W and A), works as expected, the simultane pressing of both is interpreted well. When I enter e.g. the LeftActionAlias "StrafeLeft" as an ActionAlias in the ootii Easy Input Source Controller, it is recognized, so if I press "A", the character strafes to left. But: Here the same behaviour as in MMO style occurs: I have to press the A key on its own, otherwise it is not recognized....
     
  16. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Hey @tomaro ,

    All of this is as expected. You just want to make sure you look at the User's Guide (pg 17) and check out all the properties on the different motions.

    When you press 'Adventure Style', 'MMO Style', or 'Shooter Style' on the Basic view, it auto sets up motions for you based on the style (page 12). You can see these motions on the Advanced view.

    MMO Style mimics World of Warcraft using the "Walk Run Rotate" motion. So pressing 'A' or 'D' rotates your character (when Rotate with Input) is checked.



    Like in World of Warcraft, holding the "ActivateRotation" alias (right-mouse-button) will change the AD keys from rotate to strafing.

    I have a feeling Rotate With Input isn't checked.

    There's a lot of properties on most motions. This way you can control things how you want. Just scan down them and make sure they are set the way you want. :)
     
  17. ade72

    ade72

    Joined:
    Mar 20, 2019
    Posts:
    8
    Thanks a lot. Now it is working. Walking, running, jumping, climbing. Just when I add "Punch", the character freezes in the animation it was and control is no more possible.. :-( Sorry for that much questions...
     
  18. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    771
    After you add the Punch motion, you then need to generate its animation states on the Animator Controller. Find the Punch motion and click on the blue gear icon on the right-hand side to open up its detailed settings. Then click the Create Animator State Machine button:

    upload_2019-5-22_13-48-25.png

    I have this on the Upper Body motion layer, as the motion was written with the intent of it running masked to the upper body (so the character can be walking simultaneously).

    Any time that you add a motion to a character, you will need to create its state machine on the animator controller (unless you're sharing an animator controller between characters and it has already been set up there).

    The Character Wizard (under Windows -> ootii Tools OR right-click on a character model or prefab in the Project view) will totally configure a subset of motions, but I haven't added all of the possible motions to it yet.
     
  19. Dermestes

    Dermestes

    Joined:
    Aug 9, 2015
    Posts:
    9
    In the scene demo_SpellCasting, I click on Teleport Self, Poisonous Fog, or Firewall and the character seems to get stuck at animation 2H_Cast_01_b. Burst Lightning gets stuck on 1H_Cast_01_b. Both animations just keep repeating and never moves on to the next phase. The Magic Missile and Fire Ring Self seem to work correctly. Anyone else with this issue?
     
  20. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    771
    @Dermestes - I haven't used the Spellcasting MP that much recently, and I generally just test casting a Magic Missile when testing to make sure that the casting motion still works after I make a change. :cool: I'll have a look at those spells this week and see what's up with them.
     
  21. Dermestes

    Dermestes

    Joined:
    Aug 9, 2015
    Posts:
    9
    Mainly, I wanted to see how spells were handled and if it could be adapted to melee usable skills but wanted to start with a working platform. Thanks for looking into it.
     
  22. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    771
    Just tested them now... Teleport Self and Poisonous Fog use a Utility - Set Position node, so you need to set the target after you start casting, once you're in that "casting" loop. There is a targeting indicator that follows the reticle in the center of the screen to show where the spell will take effect. Once the indicator is where you want it to be, click the left mouse button again to complete casting the spell:

    upload_2019-5-23_10-58-49.png

    This should probably be made more apparent, as it does work differently than a self-targeted spell or something like Magic Missile. I'm definitely open to suggestions. :)

    Burst Lightning uses a Utility - Set Target node, and when you move the reticle over one of the enemies, he should become highlighted. Cliclk the left button again to complete casting:
    upload_2019-5-23_11-0-19.png


    EDIT: What Unity version are you using? I tested this on 2018.3.10f and 2017.3.1f.
     
    Last edited: May 23, 2019
    Tryz and hopeful like this.
  23. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    214
    Hey guys.

    My custom combat animations move my main character forward since the footwork is an important feature to make the combat more realistic, it causes a very annoying problem:

    After a while of fighting if I continue to hit the enemy the two characters (Player and NPC) gets way to close to each other and nearly stand on top of each other.

    The way i thought of "dealing" with this issue is to push the character backward once he is hit however I am not quite sure how to do that with the motion controller?

    Also if one of you guys know a better way of dealing with the problem please let me know :) any help is appreciated!
     
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    You should be able to handle this like with any other character collision.

    1. Make sure both characters have colliders on them (even if I automatically create them with body shapes)

    2. Make sure your player character's Collision Layers (on the Actor Controller) are set to collide with the layer your NPC is on.



    With fighting, there's no difference. The movement that comes from your animation would still respect the colliders (as long as it's coming through as root-motion). However, the character may have a wider stance.



    This may let them get too close for your liking. So your best bet is to adjust the colliders on your character dynamically to have the spacing you want based on the stance/motion/animation that you're using.

    You can do this by tapping into the MC's "Motion Activated" and "Motion Deactivated" events.


    In the odd chance the characters are actually not respecting the colliders, check the layers and make sure they are flagged to collide with each other.
     
    Censureret and antoripa like this.
  25. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    214
    @Tryz Thank you, Tim, I will try it out!

    One more question:

    I have some movement animations that don't include velocity. (meaning that they are in place animations).

    When i use these in in the Basic Walk Run Strafe motion the character moves very very very slow i am guessing because this motion expects the animations to have velocity. So my question is how can i use these animations and still make the character move normally?
     
  26. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    214
    Actually i figured it out :) you can set it in the motion :D
     
    Tryz likes this.
  27. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    Using the controller in Adventure Mode - Is it possible to make the character turn (and animate) without taking extra steps after the turn?
     
  28. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    771
    Yes. If you go to the list of Motions on the MotionController and select the WalkRunPivot motion, you can uncheck the Use Stop Transitions setting:


    upload_2019-6-11_12-16-17.png

    The code used by this motion is WalkRunPivot_v2.cs. It follows the original design of the motions, where the code is tightly coupled with the animation clips. Upon initialization, these motions will store the hash ID of each animator state and transition in a corresponding variable and use these in their internal logic.

    That approach provides a great degree of control, but is not very flexible in terms of swapping out animation clips in the Animator Controller. There are a series of "Basic" motions which are better suited for the task of applying the same underlying logic to different sets of animation clips. I tend to forget about the "Basic" tab on the Motion Controller inspector... those options should probably use newer set of motions. I'll add that to my to-do list.

    If you go to Window -> ootii Tools -> Character Wizard, there's a more robust tool for quickly setting up characters; this tool uses the newer "Basic" motions. You can also right-click on a character model or prefab in the Project view and pick "ootii Character Wizard" from there.

    EDIT: The BasicWalkRunPivot and BasicWalkRunStrafe motions don't use any start/stop transitions, as many animation sets don't include those (or just aren't consistent in which ones they include).
     
  29. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    Running the character wizard and using the "Basic" motions for those has improved this dramatically! Thanks!

     
    Tryz, hopeful and TeagansDad like this.
  30. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    214
    Hey, guys, I hope everyone is doing well.

    I have a few pressing questions that i would really love if someone has some answers for :)

    **How do I know that a motioncontroller motion has executed**

    I am thinking that this has to be somewhat a "common" issue. We want our NPC controllers to know when they have executed an attack, ability or any other motion. So is there a way to subscribe to a motion and listen to its "deactivation" method?


    **How can I set my NPC's to run or walk**

    Now since we have BasicWalkRun and BasicWalkRunPivot. Is there an easy way to programmatically set an Actor to run and walk.
     
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    If you look at the bottom of the MC UI, there is a section for events. Open that and you can use standard Unity event handlers for listening for Motion Activate, Motion Deactivate, etc.

    In the NPC movement video, I believe I talk about this. I can't get in front of my computer until the weekend, but there is a MC.NormalizedSpeed property (or something close) that you set to 0 for idle, 0.5 to walk, and 1 to run.

    This weekend I'll find the exact code. On my phone now.
     
  32. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    771
    I got ninja'd by @Tryz while writing this, but I'll post it anyway as I was going into a bit more detail.

    Yes, and in fact there are multiple ways that you can do this. :)

    The most straightforward way would be to hook up an Unity Event. Expand the "Events" section of the Motion Controller's inspector and you'll find all of the motion-related events:

    upload_2019-6-18_13-27-11.png

    Assign the character to the "Object" field when you add an entry, and in the dropdown to the right, you'll be able to browse all of the public functions on each component on the character. You'll generally want access to the MotionMessage so that you can identify which motion was deactivated, so the public method that you assign should generally take the form of:

    Code (CSharp):
    1. using com.ootii.Actors.AnimationControllers;
    2. using com.ootii.Messages;
    3. using UnityEngine;
    4.  
    5. public class NewBehaviourScript : MonoBehaviour
    6. {
    7.     public void OnMotionDeactivated(IMessage rMessage)
    8.     {
    9.         if (!(rMessage is MotionMessage lMessage)) { return; }
    10.  
    11.         // lMessage.Motion holds a reference to the MotionControllerMotion
    12.        
    13.         if (lMessage.Motion.TagExists("DisableFootIK"))
    14.         {
    15.             // Do something
    16.         }
    17.     }
    18. }
    19.  
    You can also build a custom Reactor Action to respond to a motion's deactivation. Reactors are good for self-contained behaviours that you want to re-use on multiple characters. Look under Assets/ootii/Assets/Framework_v1/Code/Game/Reactors/Actions for AgentUseTransform.cs and BasicHandPoseReactor.cs for examples. Both of these reactors listen for motion activated and deactivate events and perform specific tasks in response.

    You can look at Assets/ootii/_Demos/Shared/Scripts/DemoNPCController.cs for a basic example using the NavMeshAgent.

    There is also the NavMeshInputSource component, which you can place on an NPC (with a NavMeshAgent) and assign it as the Input Source for that character. Then use the public methods on the NavMeshInputSource to move the character.

    I would also suggest having a look at the Node Canvas integration from the Motion Vault. The NavigateTo task is a very comprehensive example that you should be able to adapt into another form.
     
    rubble1, FargleBargle and Tryz like this.
  33. stanislavdol

    stanislavdol

    Joined:
    Aug 3, 2013
    Posts:
    269
    @Tryz
    Hi, finally got a bit of free time to play with Third Person Motion Controller.

    I noticed that when you run/walk forward and jump, after landing you continue moving without a stop. But when you move in any other direction and jump, after landing you stop for half a second and then continue moving.
    Not sure what is causing this, I assume it switches to idle after the jump, but I can't seem to find out why it depends on the direction.
    Is there a way to remove the stop?
    Thanks
     
  34. Asset-Ninja

    Asset-Ninja

    Joined:
    May 9, 2015
    Posts:
    12
    Unity 2019.1.8f1 overflow exceptions

    Greetings! I was wondering whenever someone noticed or is it just me - in Unity 2019.1.8f1 i get a lot of overflow exceptions like these:

    OverflowException
    com.ootii.Actors.BodyCapsule.CreateUnityColliders () (at Assets/ootii/Assets/Framework_v1/Code/Actors/CharacterControllers/BodyShapes/BodyCapsule.cs:535)
    com.ootii.Actors.BodyShape.set_UseUnityColliders (System.Boolean value) (at Assets/ootii/Assets/Framework_v1/Code/Actors/CharacterControllers/BodyShape.cs:59)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
    com.ootii.Actors.BodyShape.Deserialize (System.String rDefinition) (at Assets/ootii/Assets/Framework_v1/Code/Actors/CharacterControllers/BodyShape.cs:421)
    com.ootii.Actors.ActorController.DeserializeBodyShapes () (at Assets/ootii/Assets/ActorController/Code/Actors/CharacterControllers/ActorController.cs:4489)
    com.ootii.Actors.ActorController.Start () (at Assets/ootii/Assets/ActorController/Code/Actors/CharacterControllers/ActorController.cs:1106)

    The main reason is, that "radius" is ZERO and you get some fancy numbers here:

    Code (CSharp):
    1. Vector3 lToEnd = lLocalEndPosition - lLocalStartPosition;
    2. int lCount = (int)(lToEnd.magnitude / (_Radius / lScale));
    3.  
    4. if (mColliders == null || mColliders.Length != lCount) { mColliders = new UnityEngine.Collider[lCount + 2]; }
    lCount in this case becomes -2 milions and of course it can not work. Any idea?

    I just added basic motion controler via menu. Happens with all actors. The funny thing is, that the samples DO NOT have this issue.

    Thank you in advance!
     
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    This would be in the Jump motion (Jump.cs).

    The MC is using root motion and in the landing animation of the jump, there's no movement root motion. I didn't like that and added code to keep the character moving forward if you're moving in the direction of the jump.

    If you're trying to move in a different direction of the jump, it made sense to me that you'd land, stop, and change direction. I totally understand if that's not what you want. To change that, you can go into the Jump motion and modify the code how you want. Start looking around line 710 and the other conditions that follow. You can set the "mMovement" property to force movement however you want.
     
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Hey @Asset-Ninja ,

    This is happening because you've got a body shape in the Actor Controller component, but you've set the radius of that body shape to "0". Either remove the body shape if you don't want it or don't have a radius of "0".

    I checked and it's not defaulting to "0" for me. Having a sphere or capsule with a radius of "0" really won't make sense.
     
    Asset-Ninja likes this.
  37. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    771
    It might be related to the comma-as-decimal-separator issue with serialization. I've been shown a video where the user was getting really odd default radius values for the body shapes (negative decimal values, I think). I can't figure out where it's coming from.

    @Asset-Ninja what country do you live in (or I suppose, which country's locale settings is your computer using)?
     
  38. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    214
    Hey. Really really really odd thing has just happened to me. with an attack where there is root motion. However, when my NPC attacks the root motion is not applied?

    I have been digging for hours to try and figure out what and how and have tested the following:

    When adding a normal animation controller without any scripts and with the same avatar and only that animation root motion is applied (if i tick of the box)

    I have also tried in the preview window and he runs the animation with root motion here as well.

    Now after hours of digging. I found something I haven't seen before a reactor called: "Agent Set Use Transform". At first i thought this was it. However, when disabling the reactor I get no result:


    upload_2019-6-25_23-23-5.png

    Has anyone tried something similar to this?
     
  39. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    771
    @Censureret - The "Agent Set Use Transform" reactor (I know it's an awkward name, but I couldn't think of anything better) is used in conjunction with the "Use Transform" setting on the Actor Controller. When a motion with the "UseRootMotion" tag activates, the reactor disables "Use Transform" to allow the root motion to move the character, then re-enables that setting when the motion deactivates.

    The motion needs to include this tag for the reactor to work, so that's something to double check.

    I did test out an NPC that I set up via the Character Wizard just the other day, and it was working (I use Kubold's animations). The default Character Wizard setup adds the "UseRootMotion" tag to BasicMeleeAttack, BasicDamaged, BasicDodge, and BasicDeath.

    The default Mixamo animations don't use root motion for the attack or damage animations, so I never got around to documenting this. :oops:

    If the tag isn't the problem (and I think I put a public field on the reactor to allow you to change the tag it looks for), then if you zip up and PM me a project, I'll have a look at it for you
     
  40. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    114
    I'm just going to throw this out, are there any plans for a dedicated Facial Animation System of some sort?

    Maybe I can create it with Motion Controller, but would there be room for some sort of dedication to that area?
     
  41. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    214
    Hey, I tried removing the reactor completely and there still wasn't any root motion. I don't use Mixamo's attack animations but a custom attack animation that 100% has root motion built in. So i simply can't understand what the problem is :S
     
  42. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    771
    Do you have Use Transform unchecked on the Actor Controller?

    upload_2019-6-26_10-49-25.png

    If Use Transform is checked, you won't get any root motion movement.
     
  43. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    214

    This is VERY new to me ive been using the motion controller for 2 years and always had that option on? But i will test it out.
     
  44. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    771
    It's not selected by default if you add the components manually. If you're settling up an NPC with the Character Wizard, it sets Use Transform by default and adds the AgentSetUseTransform reactor. It's simpler to get NPCs moving and animating with Use Transform when using a 3rd party AI system, so I went with that for the Wizard. I plan on making that more configurable at some point.

    You'll get better visual results using the NavMeshInputSource or the custom NavigateTo task for NodeCanvas or Behavior Designer, but those require more configuration than what I was going for with the Character Wizard.
     
  45. Hypester

    Hypester

    Joined:
    Jan 23, 2018
    Posts:
    17
    Hey, so I'm really enjoying playing around with this in my prototype. I have run into a bit of an issue trying to get an NPC (an UMA specifically) to get going. I've done something between the NavMeshAgent and the Actor Controller and the Motion Controller which doesn't quite work. Here's what the console is spraying out every second:


    Parameter 'L0MotionStateTime' does not exist.
    UnityEngine.Animator:SetFloat(String, Single)
    com.ootii.Actors.AnimationControllers.MotionController:SetAnimatorProperties(MotionState&, Boolean) (at Assets/ootii/Assets/MotionController/Code/Actors/AnimationControllers/MotionController/MotionController.cs:2374)
    com.ootii.Actors.AnimationControllers.MotionController:OnControllerLateUpdate(ICharacterController, Single, Int32) (at Assets/ootii/Assets/MotionController/Code/Actors/AnimationControllers/MotionController/MotionController.cs:1172)
    com.ootii.Actors.ActorController:InternalUpdate(Single, Int32) (at Assets/ootii/Assets/ActorController/Code/Actors/CharacterControllers/ActorController.cs:1412)
    com.ootii.Actors.ActorController:ControllerLateUpdate(Single, Int32) (at Assets/ootii/Assets/ActorController/Code/Actors/CharacterControllers/ActorController.cs:1371)
    com.ootii.Actors.BaseSystemController:LateUpdate() (at Assets/ootii/Assets/Framework_v1/Code/Actors/BaseSystemController.cs:264)
    com.ootii.Actors.ActorController:LateUpdate() (at Assets/ootii/Assets/ActorController/Code/Actors/CharacterControllers/ActorController.cs:1324)


    Anyone have an idea of what I'm missing here. My player character doesn't seem to be having any of these problems. When I disable the NPC's motion controller, it all goes away.
     

    Attached Files:

  46. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    771
    Yes. Your NPC's animator controller is missing the parameters named in the error messages.

    On the NPC's Animator component, assign the same Animator Controller asset that you use for the player.
     
    Hypester likes this.
  47. Hypester

    Hypester

    Joined:
    Jan 23, 2018
    Posts:
    17
    Boom, that's it. Whew, thank you!
     
  48. cspid

    cspid

    Joined:
    Apr 25, 2014
    Posts:
    21
    Hello I'm having some trouble with the interaction system - I'm able to trigger the actions in the demo by pressing 'f' to interact, but how can I trigger it another way, such as with a UI button? I need to character to use the Force Position and Force Rotation functionality on the interactable core object before beginning the interaction. Seems simple enough but I've had a tough time finding a solution, help would be appreciated. Thanks!
     
  49. stanislavdol

    stanislavdol

    Joined:
    Aug 3, 2013
    Posts:
    269
    Thank you!

    Another issue I noticed:
    Sometimes input is completely ignored, I can press a button and it doesn't trigger a movement(I use your unityinputsource script) (there is no issue with the button itself, a separate script detects it at the same time just fine).
    So, for instance, I press and hold "W" and the character doesn't start running.
    I tried to debug it but failed to find a source of an issue. It seems to happen absolutely randomly, even on a flat surface(at first I thought it was a grounding issue)
     
    Last edited: Jul 1, 2019
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Unfortunately I've never seen this and can't reproduce it. I've also never had anyone else report the issue. So, I think it's something unique to you.

    First, check if this is happening in my demo scenes.

    Next, make sure the root of your character touches the ground. Typically it's at the feet. This root is what determines if you are grounded.

    Finally, check your Unity Input Manager to make sure you don't have some delay.

    Have you modified any of the motions, animations, animator state machines, code, etc?