Search Unity

Motion Controller

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

  1. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    770
    My home PC bluescreened and won't boot and I haven't had time to troubleshoot it, so I had to wait until I was on the other computer I use for development.

    This .unitypackage contains a few extensions that I made to further integrate Motion Controller with Inventory Pro.

    The InventoryProAttributeSource inherits from BasicAttributes and thus you'll need to remove BasicAttributes. When you get or set the value of a float attribute, its default behaviour is to attempt to find a stat with a matching name in the Inventory Player's StatCollection. The default category and separator character are configurable in the inspector:

    upload_2019-3-5_10-17-58.png

    So when the code calls IAttributeSource.GetAttributeValue<float>("Health"), by default it will follow the conventions of the Inventory Pro API and try to find the Default_Health stat.

    Because it inherits from BasicAttributes, you can use it exactly the same way to add any other custom attributes to the character.

    The package also contains:
    • InventoryOotiiInputController, which implements Inventory Pro's IPlayerInputCallbacks interface to enable/disable the Motion Controller's Input Source and show or hide the mouse cursor as appropriate.
    • AdvancedItemDropHandler, which inherits from Inventory Pro's ItemDropHandler; this component ensures that the dropped item has a Rigidbody component with gravity enabled and Discrete collision detection
    • SpellInventoryProItem, which is a basic integration for the Spellcasting Motion Pack. In its current form, it's essentially used to cast a spell from the shortcut bar. You assign the Spell prefab in the inspector (the inspector has a field for "Mana Cost" but I never got around to implementing that), and it will activate the BasicSpellCasting motion when the item is used. To use this, you'll probably need to disable "Requires Stance" on the BasicSpellCasting motion and also remove the Action Alias on both that motion and SpellInventory, or else you'll get spells going off when you don't want them to.
    Be aware that I haven't used these scripts for quite a while, nor am I currently developing anything with Inventory Pro. So I haven't recently verified how functional they are. I know that Inventory Pro is in maintenance mode (and has been since before Rucksack was released), so hopefully it all still works fine. :)
     
    drcfrx, Tryz, Aceego and 1 other person like this.
  2. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    71
    Wow this is great timing! I'm about to start work on a project using Inventory Pro and this will come in super handy. Thanks for all your hard work TeagansDad, you are a huge contributor to this community and i'm sure everyone appreciates your efforts. Looking forward to checking all this stuff out :)
     
    Tryz likes this.
  3. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    322
    i ask tim a half year ago about open a discord, but he don´t like the idea =( but maybe now he has change his mind :D i really hope a discord will be come up, i don´t look much at the unity forum and the notfications not working all time but i want to help other guys and make more intregatons with other assets, so will be nice to have a discord :D
     
    Tryz likes this.
  4. Aceego

    Aceego

    Joined:
    Apr 5, 2015
    Posts:
    37

    Wow, thank you so much :)
     
    Tryz likes this.
  5. Bukyja

    Bukyja

    Joined:
    Jul 7, 2013
    Posts:
    17
    Hello everyone, I just bought MC to integrate in Adventure Creator, but I have a couple of problems that I would like to solve, I tried first on the forum of Adventure creator but the result was not as hoped, not being a programmer I have serious difficulties to create a script from scratch. all I need is to be able to use the pivot rotation from idle, walk, run, fall and slide animations, compatible with Adventure Creator :D then I share the post in question hoping to be able to get a little help: D

    https://adventurecreator.org/forum/discussion/8560/motion-controller-integration-direct-control
     
  6. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    71
    I am not familiar with Adventure Creator so i cant help there sadly, however i also have that annoying pause bug. I'm still not sure what causes it yet but somehow setting timescale to 0 is not enough to pause in all cases.
    It seems to be related to input still being processed regardless of time and can cause players or NPC's to stretch/slide around the map. For example if you pause with some sort of input (ie walking), the Actor will continue to move with that input despite the animation itself being 'paused'. This will cause a crash if allowed to continue sliding in my case.

    My guess is it is something in the MotionController or ActorController that causes this bug. It could be there is a method which should be using delta time and isn't, or something along those lines.
    Has anybody come across similar issues with pausing?
     
  7. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    322
    you can disable the movement from ootii

    Code (CSharp):
    1.             if (m_motionController.InputSource != null)
    2.             {
    3.                 m_motionController.InputSource.IsEnabled = enable;
    4.             }  
    or you can deactivate all active motions include move

    Code (CSharp):
    1.                 if (m_motionController.ActiveMotion != null)
    2.                 {
    3.                     m_motionController.ActiveMotion.Deactivate();
    4.                 }
     
    mandisaw likes this.
  8. Bukyja

    Bukyja

    Joined:
    Jul 7, 2013
    Posts:
    17
    Ok, tryed both solutions giving me no results, i think a possible solution can be to deactivate actor when timescale is set to 0, but no idea how to insert related strings, maybe it still moving due to collider problem? :(
     
  9. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    322
    can you send me your code what you try ? or the code what opens the menu im sure my code snippets will work
     
  10. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    322
    Just a quick example i test it and works the movement stop if i press Escape

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using com.ootii.Actors.AnimationControllers;
    5.  
    6. public class MenuExample : MonoBehaviour
    7. {
    8.     public MotionController mMotionController;
    9.  
    10.     private bool menuActive = false;
    11.  
    12.     void Update()
    13.     {
    14.         //Open or Close Main Menu
    15.         if (Input.GetKeyDown(KeyCode.Escape))
    16.         {
    17.             menuActive = !menuActive;
    18.             DisableInput(menuActive);
    19.         }
    20.     }
    21.  
    22.     // Enable or Diable Motion Controller Input Source
    23.     public void DisableInput(bool enable)
    24.     {
    25.         enable = !enable;
    26.  
    27.         if (mMotionController.InputSource != null)
    28.         {
    29.             mMotionController.InputSource.IsEnabled = enable;
    30.         }
    31.     }
    32. }
    33.  

    and if you want to add timescale you can add simple this into the update function

    Code (CSharp):
    1.  
    2.         if (menuActive)
    3.             Time.timeScale = 0;
    4.         else
    5.             Time.timeScale = 1;
    6.  
     
    Last edited: Mar 7, 2019
    mandisaw likes this.
  11. Bukyja

    Bukyja

    Joined:
    Jul 7, 2013
    Posts:
    17
  12. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    322
    the script don´t make sens, so your goal is when you open the menu that the character stops right ? But in your script i don´t see how do you open the menü and this makes not sens to put it in the update function, so witch scripts opens your menu is the question or you has a other goal ?


    if you has discord than add me and show me your screen discord name

    Christian Schamara#3365
     
  13. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    322
    I think the problem is here.

    the Pause will be handel by

    Code (CSharp):
    1. if (KickStarter.stateHandler.gameState == GameState.Paused) return;
    so i think your script should be looks somethink like this

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using com.ootii.Input;
    4. using com.ootii.Actors.AnimationControllers;
    5. using AC;
    6.  
    7. public class CustomControllerLink : MonoBehaviour
    8. {
    9.  
    10.     private NavMeshInputSource navMeshInputSource;
    11.     public UnityInputSource unityInputSource;
    12.     private MotionController mMotionController;
    13.     private Char acCharacter;
    14.  
    15.  
    16.     private void Awake()
    17.     {
    18.         navMeshInputSource = GetComponent<NavMeshInputSource>();
    19.         motionController = GetComponent<MotionController>();
    20.         acCharacter = GetComponent<Char>();
    21.     }
    22.  
    23.  
    24.     private void Update()
    25.     {
    26.         // If the Game is Pause then we must handel here the input.
    27.         if (KickStarter.stateHandler.gameState == GameState.Paused) {
    28.             DisableInput(false);
    29.             Time.timeScale = 0;
    30.         }
    31.         else {
    32.             DisableInput(true);
    33.             Time.timeScale = 1;
    34.         }
    35.  
    36.         if (!KickStarter.stateHandler.IsInGameplay() ||
    37.                 !acCharacter.IsPlayer ||
    38.                 acCharacter.IsMovingAlongPath() ||
    39.                 KickStarter.settingsManager.movementMethod == MovementMethod.PointAndClick)
    40.         {
    41.             navMeshInputSource.TargetPosition = acCharacter.GetTargetPosition(true);
    42.         }
    43.     }
    44.  
    45.     // Enable or Diable Motion Controller Input Source
    46.     public void DisableInput(bool enable)
    47.     {
    48.         if (mMotionController.InputSource != null)
    49.         {
    50.             mMotionController.InputSource.IsEnabled = enable;
    51.         }
    52.     }
    53. }

    but without to see the other stuff is just guesswork
     
  14. Bukyja

    Bukyja

    Joined:
    Jul 7, 2013
    Posts:
    17
    Hmm that script (the one i had at start) was made following Adventure Creator official tutorial, anyway i have discord, used long time ago to play FFXIV with friend but no experience since some time has passed from my last use, plus my english (spoken at least) isnt good at all :D
     
  15. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    652
    I actually found another way - also slightly tricky:
    1. Divide the ladder collider into small sections, and offset them to match the slant of the ladder.
    2. Add trigger colliders to each, with a script that incrementally offsets the player's Z position.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using com.ootii.Actors;
    5.  
    6. public class TriggeredPlayerOffset : MonoBehaviour {
    7.  
    8.     private GameObject myPlayer; // Player GameObject - must have "Player" tag
    9.     private ActorController lActorController; // Actor Controller
    10.     private bool moveActive = false; // Move action locked flag
    11.     private bool moveNow = false; // Move action initiator
    12.     public float forwardOffset = 0.0f; // Forward offset amount
    13.     private Vector3 newPosition;  // Calculated new position that player will move to
    14.     public float startDelay = 0.0f; // Optional delay repositioning player
    15.  
    16.     void OnTriggerEnter(Collider other)
    17.     {
    18.         if (other.tag == "Player" && !moveActive)
    19.         {
    20.             StartCoroutine("Move"); // Start move sequence
    21.         }
    22.     }
    23.  
    24.     void LateUpdate()
    25.     {
    26.         if (moveNow)
    27.         {
    28.             newPosition = lActorController.Position + (lActorController.transform.forward * forwardOffset); // Calculate new position
    29.             lActorController.SetPosition(newPosition); // Move player to new position
    30.             moveNow = false; // Flag move as complete
    31.         }
    32.     }
    33.  
    34.     IEnumerator Move()
    35.     {
    36.         moveActive = true; // Lock moves
    37.         myPlayer = GameObject.FindWithTag("Player"); // Find Player
    38.         lActorController = myPlayer.GetComponent<ActorController>(); // Get ActorController
    39.         yield return new WaitForSeconds(startDelay); // Pause before moving
    40.         moveNow = true; // Initiate move
    41.         moveActive = false; // Unlock moves
    42.     }
    43. }

    Slanted_Ladder.png

    By using a negative offset, you can even climb overhangs. Unfortunately it doesn't work for climbing down. :eek:



    I like @Tryz' suggestion of rotating the player to match the ladder though. If I can figure out a foolproof way to do that, that reverts back to a "normal" rotation once the player leaves the ladder, maybe I'll try that instead. :)
     
    Last edited: Mar 7, 2019
    mandisaw, Tryz and hopeful like this.
  16. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    71
    This still doesnt seem like a very good solution in the long term. For example if you're using NPC's with RootMotion you would have to turn off every single InputSource in the scene, not just the Player. Also if you end up setting the active motion to null it may cause bugs in NPC's or the Player that are halfway through a motion, for example in the climb braced motion or the middle of interacting.
    It would be handy if we could pause with timescale only, i'm also thinking that anyone looking to do slow motion effects with the Ootii Motion Controller will run into issues since things aren't using timescale that need to.
    Hopefully Tim will get a chance to look at this stuff and can narrow down the issue for us.
     
    mandisaw likes this.
  17. Bukyja

    Bukyja

    Joined:
    Jul 7, 2013
    Posts:
    17
    We did a few try yesterday but nothing, anyway i found out an half solution using adventure creator, forcing while in pause to switch animation from current to idle, it dont slide anymore but the forced stop looks bad till i use transparent background on my pause menu. Hope to get better results in future.
     
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Hi @Bukyja ,

    I think I'm following the thread. You shouldn't have to turn off all the Input Sources.

    What I did in the past was set the time scale and disable the Motion Controller.

    For example:
    Time.timeScale = 0;
    lMotionController.IsEnabled = false;

    Typically that worked well for me. Just tested again and it works.


    Changing timeScale to 0.5 is working for me. I'm moving slow, jumping slow, etc. The AC and MC use Time.deltaTime.


    If pausing or setting timeScale isn't working for you, can you give me a specific example? What's the motion, how are you setting it, etc.


    Unfortunately, I don't use Adventure Creator. So, if the AC is set to "Use Transform", the movement may be coming from Adventure Creator, a NavMesh, or however you're externally controlling the transform. In those cases, you'll want to stop those from running as well. Otherwise, they will continue to control movement while the AC & MC is paused. The reason is that when "Use Transform" is checked, I give all control of movement over you you. The AC & MC no longer control movement.


    Thanks
     
    Last edited: Mar 10, 2019
    mandisaw likes this.
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    Alright folks. I'm not super familiar with Discord, but here's the link to a new 'support' channel for ootii.
    https://discord.gg/3zUFqDb

    Let me know if you have issues getting in. We'll give this a try and then I'll put the link into the asset store pages as well.
     
  20. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    71
    Glad to hear that slow motion stuff is working, im not using anything like that yet but like to have the option!
    I get this bug whenever i pause with Input (nearly 100% of the time) So if I pause when pressing w for example. The timescale is set to 0 and my character will slide forward with the input that it paused with, the feet stay in place due to IK so the player ends up streching out until the game crashes. NPC's not using IK just slide around in whatever animation they get paused on, possibly into colliders or off the map. The motion they are using doesn't matter it could by WalkRunPivot_V2, Jump, BasicWalkRunStrafe...any motion where input is processed and movement is produced.
    Does that mean i would need to turn off every single MotionController in the scene to pause correctly? That seems a bit rough, the editor pausing function works fine but in-build there's a few issues. In my case im not using anything other then Ootii systems to control the Actors Position so im fairly confident the bug is somewhere in how the AC/MC is handling the input.
    I can send you a demo if you're interested :)
     
  21. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    I see what's going on. I'll explain it so that it all ties together...

    1. Time.timeScale = 0 only

    In this case, I exit out of the MC.OnAnimatorMove() function early without clearing the saved root-motion movement values. So, the current value keeps the PC sliding.

    It makes me a bit nervous, but we can fix it by replacing the first line of MC.OnAnimatorMove() with this:

    Code (CSharp):
    1. if (Time.deltaTime == 0f)
    2. {
    3.     mRootMotionMovement = Vector3.zero;
    4.     mRootMotionRotation = Quaternion.identity;
    5.  
    6.     return;
    7. }
    That said, there's still issues.

    Since the MC is still getting input and updating, it will transition animations from walk to idle and back. Unity will play these transitions even when Time.timeScale = 0.

    So, doing this isn't a good solution.


    2. Time.timeScale = 0 and InputSource.IsEnabled = false

    This isn't really a good solution.

    When you press the "W" key, the Input Source reports MovementY = 1. When you release, MovementY = 0. When the Input Source is not enabled, I also return 0.

    In this case the MC is updating and when it gets input from a disable Input Source, the MovementY = 0. What this means is that when you pause while walking, the PC will think "disabled input" means "no input" and go to idle.

    Again, Unity will run transitions during this time and the character will animate to idle.


    3. Time.timeScale = 0 and MotionController.IsEnabled = false

    This is the right approach to use.

    In this case, the MC will stop reading input and stop processing. So, it won't pass anything to the animator. That means we don't transition from a walk to idle, we don't pass movement to the AC, etc. Instead, everything stops what it's doing.

    Yes.

    This is one of those design decisions I have to make because I don't know how people will use the assets.

    If I stop the MC whenever Time.timeScale = 0 than no one ever anywhere could run motions when the Time.timeScale = 0. Since people use motions for non-animation things (ie IK), I didn't want to be that draconian.

    Instead, you can use code like this:
    Code (CSharp):
    1. MotionController[] lMCs = Component.FindObjectsOfType<MotionController>();
    2. if (lMCs != null)
    3. {
    4.     for (int i = 0; i < lMCs.Length; i++)
    5.     {
    6.         lMCs[i].IsEnabled = false;
    7.     }
    8. }
    I agree that using the MC while Time.timeScale = 0 is rare, but I promise I'll get a support email about it eventually and be told it's a "bug". :)

    So, instead I put all the options on the table and you can disable the pieces you want when you want.

    I hope that helps.
     
  22. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    71
    Awesome! Thank you very much for the in depth reply, this extra information will definitely come in handy with determining the best solution for my projects :)
     
    Tryz likes this.
  23. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    196
    I have a few questions! ;) I'd like to use this for creating a classic 90's Tomb Raider-style engine, and it appears to be unlike other third-person assets in that it doesn't use physics, which is quite difficult to find and I need predictable movements that physics can't provide.

    Can tank-turning be added? I don't mind scripting it, but I need to know what level of complexity it might require for this.

    Are movements like climbing, grabbing, back-step (rather than camera-relative back-movement), side-jump available out-of-the-box or would it require scripting? I'm only looking for movement types in the original Tomb Raider 1, things like 6-degree swimming and such.

    Finally, is aiming with head-turning available out of the box? The actual shooting I would handle, of course, but I want to know how much of the asset takes care of making the model aim at targets and such.

    Thanks, and sorry for so many questions, your assets look awesome! :D
     
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    @Zebbi I'm not sure what you mean by 'tank turning', but there are several different motions available in order to change the movement style. If you don't like my styles, you can create your own. However, it means coding.

    Basic motions like walk, run, climb, grab, jump, etc. Are included. Swimming and combat are separate motion packs or you can create your own.

    Aiming with head turning does not exist out of the box. You can use FK/IK solutions or create your own using motions or externally.

    I hope that helps.
     
    Zebbi likes this.
  25. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    @Zebbi also, in the product description is a web demo where you can try out different scenarios.
     
  26. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    196
    Tank-turning is where you press left and right keys and the character rotates in that direction, rather than pressing left and right and having the character run in the direction. They also back-step, rather than running towards the camera.

    I believe you have a bone controller that's separate, would that take care of head turning?
     
  27. paindonger

    paindonger

    Joined:
    Sep 21, 2017
    Posts:
    17
    Hello,
    I have successfully installed and ran the spell casting motions pack in the past however I am having an issue this time. After installing everything, in the demo_SpellCasting scene if I use a spell at all it stops part way thu the spell and sinks my player into the ground. I have no idea where to start to degug this. Even just going to my magic stance by pressing 3 start the animation then sinks into the ground. Can someone point me in the right direction?
     

    Attached Files:

    Last edited: Mar 11, 2019
  28. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    770
    @paindonger - when the character does that, it means there is no animation clip assigned to that state in the animator. Check that you've installed the Mixamo animations and the included .meta files from the AnimationMeta.zip file as outlined in the instructions.
     
    hopeful likes this.
  29. paindonger

    paindonger

    Joined:
    Sep 21, 2017
    Posts:
    17
    Thanks for the quick reply. I thought I did it properly but I guess I'll start again with the import process. thanks again
     
    TeagansDad likes this.
  30. paindonger

    paindonger

    Joined:
    Sep 21, 2017
    Posts:
    17
    Turns out I think I hit "skip these files" instead of "Replace these files" when importing...what a rookie mistake
     
    Tryz likes this.
  31. paindonger

    paindonger

    Joined:
    Sep 21, 2017
    Posts:
    17
    I'm trying to get the SCMP_NPC_Controller_v2 to use a navmesh agent however as soon as I toggel off "Use Transform" the walking animation is gone. I can get the navmesh working but I have to disable the awesome SCMP_NPC_Controller_v2 script. Is there a way to have the SCMP_NPC_Controller_v2 script use the nav mesh?
     
  32. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    71
    Tim covers a lot of the NPC related questions in this video series

    There's a bunch of useful information about controlling NPC movement with the Ootii Motion Controller in them :)
     
    mandisaw and Tryz like this.
  33. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    770
    No without modifying the script. It's just meant to be a very basic AI script.

    I know that I was fiddling around with it to try and get it working with a NavMeshAgent. I'll see if I still have that kicking around somewhere.
     
    Tryz likes this.
  34. Bukyja

    Bukyja

    Joined:
    Jul 7, 2013
    Posts:
    17
    Hi, thank you for the tips, now everything is more clear, i was just missing that motionController.IsEnabled XD
    Now the full code to bridge Adventure Creator and the Motion controller might look like this:

    http://pasteall.org/1539440/csharp

    I'm not a programmer but i'm trying to learn it, so the code probably needs to be cleaned up a bit.

    Many many thanks :D
     
    Tryz likes this.
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    There is the Walk Run Pivot motion where the character will stand in place an Pivot 90 degrees when AD is tapped. To have a full rotation when held you would need a custom motion.

    You can use the Bone Controller for head turning. There is a Look At motor built to do this. You just have to determine when the motor is active and the target.
     
  36. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    73
    Hey Ootii folks!

    So I have a set-up where I've extended the BasicMeleeAttack with four subclasses (high and low versions, fast and strong versions of each). I want it so that none of these attacks can interrupt any of the others while the player is executing them. This seems to be what the priority could be used for in the MotionController motion definitions...

    However, the only way I can see to have a group of motions all mutually not interrupting each other would be to assign them the same priority, and then change the way that priority is compared so that motions with the same priority cannot overrun each other.

    The first question is, does that make sense as a solution? Is there a better way to ensure those attack motions can't overrun on top of one another?

    And then the second question, where can I make that change to the way that priorities are compared? I've been looking through the scripts, but can't find anything that looks like that comparison...

    Many thx! :)
     
  37. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    770
    @StevanJay Can you provide a bit more detail as to how you've set these up, such as:

    Does each of the subclassed motions have its own list of Attack Styles?

    How are you activating each type of attack motion... does each have its own unique Action Alias?

    Changing the way that priorities are compared is likely to have some nasty side effects, so I wouldn't recommend going that route. Instead of messing with that, you could override the TestInterruption function on your subclasses with something like:

    Code (CSharp):
    1.  
    2. public override bool TestInterruption(MotionControllerMotion rMotion)
    3.         {
    4.             if (rMotion is BasicMeleeAttack) return false;
    5.             return true;
    6.         }
    7.  
    If the motion that is attempting to interrupt is assignable to type BasicMeleeAttack, then it won't allow the interruption.
     
    StevanJay likes this.
  38. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    196
    @Tryz thanks, how is MC's integration with Bolt? As with most third-party assets, I'm sure it's just a case of adding the units, but I was interested if there's any out-of-the-box support for Bolt with it?
     
  39. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    770
    Do you mean Bolt the visual scripting asset? There isn't an official integration package, but it probably wouldn't be too difficult to build a set of actions using the NodeCanvas or Playmaker actions on the Motion Vault as a guide.
     
    Tryz likes this.
  40. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    73
    Thanks for the reply... :) Yes, each subclass has its own Attacks Styles, and its own unique Action Alias. That code you suggest is perfect, exactly what I was looking for, and a much more elegant solution than anything I had in mind! (And it's also now super simple to set up exceptions and special cases for each attack type).

    Many thanks for the awesome level of support!
     
    Tryz, Subliminum and TeagansDad like this.
  41. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,598

    Thanks, glad you guys did this, I believe this will help you and could even help you sell more. :) I see this with other assets and people will DM one another asking questions. to buy, or who need help more.. great way for your community to get to know each other more.. than on a forum.
     
    Tryz, Subliminum and TeagansDad like this.
  42. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    257
    What is the status of FinalIK support ? Is it working out of the box ? I'm thinking to use it for Interactions. Thanks
     
  43. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    322
    Final IK works fine with ootii but you have to write your own intragtion to interact with the objects, i have worked some time ago with Final IK and ootii and write some lines here in the forum about, all what you have todo is make your own interaction scripts to work with the interaction of ootii together

     
    Tryz likes this.
  44. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    257
    Oh cool ! Thanks will take a look !
     
    Tryz likes this.
  45. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    I would like to use the "Low Slash" attack, but it relies on a "crouch in" state. The sword and shield pack doesn't seem to have a crouch input defined. How should I go about getting my character to crouch when in melee? I created a simple motion for crouching, but it kinda looks like maybe I didn't need to do this. The animations for crouching are already there, a form of 103 is defined, but not sure how to set "crouch in" on a keypress (c-key for example).
     
  46. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    770
    Building a motion would be the right approach. You still need the motion to control the flow of the animator states.

    I would structure the motion's sub-state machine like this:

    upload_2019-3-19_12-26-36.png

    Use two transitions from Any State, one which uses the Standing to Crouch, the other of which goes directly into Crouch Idle:

    upload_2019-3-19_12-27-47.png

    upload_2019-3-19_12-28-7.png

    The transitions Standing Crouch to Crouch Idle and Crouch to Standing to PSS_IdlePose will use Has Exit Time; the rest do not.

    Crouch Idle to Crouch To Standing would be triggered by setting a different motion phase in response to input:

    upload_2019-3-19_13-15-42.png

    You can look at the existing Sneak or Sneak_v2 motions for guidance on how to response to input (just ignore all of the movement-related code as you won't need it). TestActivate() checks for the initial keypress, and Update() will check for the second keypress to come out of the crouch (setting the 4451 motion phase). You don't have to use the same phase IDs that I did; I just picked a random number that wasn't already assigned to something. You could use the same stance ID to represent crouching as is used for sneaking (4 or EnumControllerStance.STEALTH) -- you'll need to set that when entering the crouch and clear it when the motion deactivates.

    Then whichever motion you use to perform the crouching attack would check that the character is in Stance ID 4 when checking its activation conditions.
     
    mandisaw likes this.
  47. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    Thank you for the detailed crouch solution, I will set that up the way you suggest.

    The animator appears to be already set up to do crouching melee (after running the character setup tool and adding the Sword & Shield motion pack):

    upload_2019-3-19_16-29-29.png

    I believe all these attack states are called "Attack Styles" in the UI.

    upload_2019-3-19_16-46-21.png

    What I want to do is play a specific Attack Style based on a specific input. Seems like I should be able to add Basic Melee Attack motions, set an action alias, and set the Attack Style for each one, but what happens at runtime is the Attack Styles list in the UI is reduced to only Slash and Back Slash.

    upload_2019-3-19_16-48-15.png

    ^^ Is this perhaps a bug? I simply want to implement control where holding a key/button forces the low slash Attack Style.
     
    Last edited: Mar 19, 2019
  48. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    770
    @Awesumo - I don't know if BasicMeleeAttack was really designed to have multiple instances running on the same layer. When I get a chance, I'll have a more thorough look to see if there's anything that would be an issue.

    The part where it's overwriting the attack styles is probably due to the Attack Profile associated with the weapon overwriting what's best up on BasicMeleeAttack. This is the way that the Attack Profiles are intended to work -- you're just defining the attack styles in a reusable data asset, rather than on the component. However, I definitely did not consider the use of multiple BasicMeleeAttack motions on the same motion layer when I wrote that code, so that's my bad.

    I can add a string field to the Attack Profile to soecisp the name of the BasicMeleeAttack motion to match the set of Attack Styles to. That should fix the problem of the styles getting overwritten. I don't know if I can get to that in the next week or two due to various circumstances beyond my control.

    In the meantime, you can try using a custom Reactor to change the index of the Attack Style after the attack begins. One of the samols reactors does this, I believe. This will only work if your crouch attack uses the Combat Attack alias plus another key (shift-click, for example), as you'll need the left click to activate the motion and then check if the shift is held in the reactor.

    Not an ideal solution, but hopefully it can be adequate in the short term.

    Oh yeah -- you can also get rid of the Basic Attack Profiles Reactor on the Actor Core; this is what listens for a weapon set to be equipped and reassigns the attack styles. That's probably the easiest solution until I can rework the way Attack Profiles are applied. ;)
     
    Subliminum likes this.
  49. AdminArdagor

    AdminArdagor

    Joined:
    Feb 6, 2018
    Posts:
    11
    Please help:(, I need to percussion struck with the sword - when moving (ie, the animation of the strike with the sword was played for the upper body of the character). I found this opportunity only for an archer (he moves and can simultaneously shoot) How can this be done for a warrior? (If it is possible in more detail since I just started studying the asset)
     
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,222
    To have Unity play two animations at once (ie walking and swinging a sword), you have to put the animations on different Unity Animator layers and different MC layers too.

    With my motion packs, I do that. If you follow the user guides, you can set the layer index to 1 (on the 'Packs' view of the MC). Then, you can walk and swing at the same time.