Search Unity

Motion Controller

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

  1. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    96
    Have you set the Motions to Override Layers? Override.jpg

    that plus the motions themselves need to start playing whatever animation in sync. So make sure that the transition>animation state timing matches up for both Actor's animation controllers, and that the moment when the motions on both actors start the synced phase is the same too.
     
  2. LeakySink

    LeakySink

    Joined:
    Apr 9, 2012
    Posts:
    141
    @Subliminum Great suggestion, thanks! Now I'm good.

    Has anybody had experience writing their own motions and integrating them with the rest of their code? As they inherit from the MotionControllerMotion I can't access any of the basic mono behaviours I normally world, getcomponent etc.
     
    Subliminum likes this.
  3. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    949
    MotionControllerMotion will have a reference to the MotionController at runtime. So you can just call mMotionController.gameObject.GetComponent() and the like.
     
  4. msik

    msik

    Joined:
    Dec 7, 2017
    Posts:
    11
    Should I be using reactors to enable ragdoll on death?

    What I did:
    - add a Unity Event Proxy Reactor to the ActorCore
    - MessageReceived > 1108
    - ReactorAction > EnableRagdoll()
    Issue:
    Ragdoll is enabled on the player whether the player kills someone or is killed.
     
  5. msik

    msik

    Joined:
    Dec 7, 2017
    Posts:
    11
    Should I be using a Reactor / MessageID when I want something to only trigger on the actor's self? Such as the above example or say blocking. Or should I be using animation events? State set? State change?

    Is there a MessageID for initiating a block or parry? IE - when you first begin the blocking animation.
    I found that:
    MSG_COMBAT_DEFENDER_ATTACKED_BLOCKED = 1103;
    is called when any actor successfully blocks an attack. I want to drain stamina when the player initiates a block.
    What is MSG_COMBAT_DEFENDER_ATTACKED_PARRIED hooked up to? I couldn't find parrying in the animator or controls.
     
  6. msik

    msik

    Joined:
    Dec 7, 2017
    Posts:
    11
    I have the sword and shield on layer 1 and archery on layer 2.
    How would I go about adding new weapons, some of which have unique animations and some that are the same type.
    Example 1: The player can equip different swords and shields.
    Would I have to re-create layer 1 for each set or can I re-use the layer since the weapon/shield combo uses the same animations and logic?
    Example 2: The player can equip a two-handed sword.
    Would I have to re-create layer 1 and swap out the animations or is there a simple approach?
     
  7. msik

    msik

    Joined:
    Dec 7, 2017
    Posts:
    11
    I followed your YouTube tutorial (
    )
    for adding an attack animation for when a different weapon is equipped. Has something changed with Attack Styles since then? When I equip sword and shield all of the listed Attack Styles disappear under BasicMeleeAttack except for Forward and Back Slash. So when I add my own Attack Style (Two Handed Sword slash) it just disappears from the list and thus I can't update the attack style using a Reactor in the way you did with PC_Reactions in the aforementioned video.

    edit: figured out this one, I had an Attack Profile attached to my weapon, which overrides the Attack Styles with the ones you assign
    e2: So I guess an Attack Profile essentially replaces the need for the behavior seen in PC_Reactions?
     
    Last edited: May 13, 2021
    Subliminum likes this.
  8. LeakySink

    LeakySink

    Joined:
    Apr 9, 2012
    Posts:
    141
    Hey! Thanks for all the answers they really are helpful.

    My new problem is BasicMeleeAttack, so with many motions I've just made my own, inherited from MotionControllerMotion and done various things, getting my own components and interacting with my logic and managers etc. However with BasicMeleeAttack I've needed to change it directly to get around the attack profile reactor stuff (can't figure that out) but inside BasicMeleeAttack I can't find a way to get data into or out of that class, I can't reference any of my external classes within it, I can't access that class externally via getcomponent. I even tried making an intermediary class that exists in one of the ootii namespaces that can reference my stuff but also be accessed inside BasicMeleeAttack and that still didn't work.

    Say I wanted in a completely external script, to gain access to the chain index from BasicMeleeAttack (assuming it was public not private) can somebody please explain how I would do that?
     
  9. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    177

    From the documentation:


    Code (CSharp):
    1. using UnityEngine;
    2. using com.ootii.Actors.AnimationControllers;
    3. public class dev_Simple_Code : MonoBehaviour
    4. {
    5.      protected MotionController mMotionController = null;
    6.  
    7.      void Start()
    8.      {
    9.           mMotionController = gameObject.GetComponent<MotionController>();
    10.      }
    11.      
    12.      void Update()
    13.      {
    14.           MotionControllerMotion lMotion = mMotionController.GetMotion(0, "MyJump");
    15.           MotionControllerMotion lMotion2 = mMotionController.GetMotion<Jump>(0);
    16.      }
    17. }
    You can find this on page 28 at https://ootii.com/Unity/MotionController/MC2Guide.pdf
     
    LeakySink and Subliminum like this.
  10. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    177
    You could also be having an issue with the assembly definitions. If you are modifying Ootii's code, it is in an assembly definition and that will need to be modified to gain access to other code I believe.
     
    LeakySink likes this.
  11. msik

    msik

    Joined:
    Dec 7, 2017
    Posts:
    11
    How do all of the different "Forms" relate? Like for Sword_01 in the inventory it's 100 for equip, unequip, including the weapon set.
    The shield_01 however, has form 400 under items in the Basic Inventory, but shares the form 100 in the weapon set Sword and Shield. Although that is named Current Form.
    I can see that shield_01 has no equip motion because it it assigned to the LEFT_LOWER_ARM for the sword and shield weapon set and so I guess it doesn't need an equip motion, but what is the 400 form for then?
     
  12. msik

    msik

    Joined:
    Dec 7, 2017
    Posts:
    11
    Curious why this line is commented out in BasicMeleeBlock.cs:
    if (mCombatant.SecondaryWeapon != null)

    I'm trying to build a custom motion for parrying and this was causing block to compete with it. If I set Parry to a lower priority it would be activated instead, but then Block wasn't being activated at all. I instead uncommented this line and this allows me to activate parry if I add the opposite check in TestActivate() for secondaryWeapon == null.
     
  13. msik

    msik

    Joined:
    Dec 7, 2017
    Posts:
    11
    Should I be creating a unique equip / unequip motion for each weapon in my inventory?
    I can see that sword_01 uses BasicEquip1 and longbow_01 uses BasicEquip2.
    I thought maybe this was because they are on separate layers (1 and 2 respectively).
    Reusing BasicEquip1 for my 2 Handed sword and setting a unique equip motion (639 - still not sure if this should match the current form of the weapon set) seems to allow me to equip the 2 Handed sword with input '3'; however, I cannot switch back to any other weapon with '1' or '2' as it breaks the animator parameters somewhere. The character gets locked into an idle animation.

    So where did I go wrong here?
    And where does the mapping of '3' come from?
    e: seems like the equip input is based on the index of the weapon sets
    Solved: had L1MotionPhase on the unequip transition set to incorrect int
     
    Last edited: May 14, 2021
  14. LeakySink

    LeakySink

    Joined:
    Apr 9, 2012
    Posts:
    141
    @KeithBrown Thanks for the advice! Will check out that solution.

    My next problem is related to the camera vs input processing, I'm trying to make a resident evil style camera where on entering a new trigger a new camera is enabled, that works fine in that I just update the camera rig in the motioncontroller to the new camera and everything is now relative to the new camera, no problem, except then you end up just running right back towards that previous camera, so I tried queuing up updating the camera rig until no input is pressed, that works but has some other issues so what I really need to do is at the input level preserve the forward input while it's still being held down but update the other directional input on camera switch, then when no input is pressed set it all back to normal. That stuff is a bit of a black box with little documentation does anybody have any suggestions?

    @msik I would just create your own block & parry motion together rather than editing BasicMeleeBlock. I've had more success just making new ones.

    Appreciate everybody's time, thanks again.
     
    msik likes this.
  15. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    627

    First I would ONLY use one camera.. Second, be sure you are enabling and disabling the other cameras to perform which ever functions you want it to. Keep it simple. If you are wanting to use two Cameras that is be sure to switch to the other, and have the one camera disabled while performing those functions. This way it can't go back to the previous, it sounds to me like you have both enabled the whole time and are just switching views.

    It sounds to me like you have conflicting cameras.... I don't use more than one camera for Unity, Unreal or any engine. Allow it to move, perform the functions you want it to.

    For example say you have first person camera, and you want it to be third, have to switch camera's.. or you can have it move to the third person spot. ( easy to do) . Having one camera saves having conflicts with cameras and other headaches.
     
  16. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    627

    You can copy some of the old motion and edit it to make your own, I did that when I first started using MC years ago.. Just becareful that you make changes where its needed. with the new motion...

    When I used MC, I stripped it to bare bones, and added all of my own motions, and functions. I only used Climbing, and the bare controller itself. That was basically it.

    PS: Use what Otti has as a guide, go through each motion, functions in code as well, to see how it did it so you understand how it works, go through all of the motions/animations graphs , settings etc as well....

    This way you 100% understand how it all works, before moving on... Its best to go through all of it when editing....
     
    msik likes this.
  17. LeakySink

    LeakySink

    Joined:
    Apr 9, 2012
    Posts:
    141
    @Recon03 I'm using one camera, with several virtual cameras I switch between, the issue is that I need to preserve the forward momentum from the previous camera while it's still being held down otherwise say the cameras face opposite one another the character will just constantly run back and forth between them when the button is held down.
     
  18. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    627

    It sounds to me, then you need to use priority between cameras, so you can still be able to use the state of the other .


    I use the old camera system as I made a custom one years ago... but since you are using the new one, this is state base, and more animation base. You can set prioity of one camera, and have the other blending to the another. with your virtural cameras.





    Priority
    Weight, the larger the value, the higher the priority. For example: a VirtualCamera in a non-Live state, when its Priority value is greater than or equal to the VirtualCamera in the current Live state and is in the active state, then CinemachineBrain will select it as the new VirtualCamera in the Live state.

    see the blend Hint...

    BlendHint

    As you can see from the first example, when a VirtualCamera is mixed with another VirtualCamera, the Camera will have a course of action, and it will be accompanied by the rotation of the Camera. The setting can choose the route mode when mixing to this VirtualCamera or mixing from this VirtualCamera to others.

    Read the link below..

    https://www.codetd.com/en/article/11882085

    This sounds like is what your trying to do...
     
    Last edited: May 16, 2021
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey all!

    Wow. It's been a while, but I'm back and working on catching up on the emails and posts.

    For those of you that didn't know, my family and I moved to Japan for 2 years and I led the software and game development integration and completion of the Mario Kart AR ride.



    Of course no one expected the pandemic and all the vendors were sent home; leaving me and a really small team. Unfortunately, it also meant I couldn't come home for about a year and a half. Needless to say, that wasn't the plan.

    So, in late February we finally returned home and were able to see my kids, mom, and family. I also started a new job with Universal Creative in Orlando... March and April were a blur.

    Things have finally started to calm down and I'm trying to catch up. I know I'm behind on support and I'm sure I've taken my hits in reviews, but I haven't abandoned the assets.

    On a cool side note, I got to work with some amazing and iconic folks at Nintendo. That was mind-blowingly awesome. :)
     
  20. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    69
    Welcome home! Feel free to share stories :).
    Cheers,
    A very satisfied customer
     
    TeagansDad and Tryz like this.
  21. drcfrx

    drcfrx

    Joined:
    Jan 26, 2013
    Posts:
    48
    I'm not religious at all, but, damn, ALLELUIAH!!
     
    TeagansDad and Tryz like this.
  22. unity_zI0bplWwlBVpmA

    unity_zI0bplWwlBVpmA

    Joined:
    Feb 22, 2020
    Posts:
    2
    Please how i can fix and modify the spine position and rotation on the archery motion pack?
     

    Attached Files:

  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    I'm guessing that it's the "Look IK". I use this to help force the bow to look forward with the camera when you're aiming and firing.



    The nock of the bow gets pulled by the right index finger. Than, the forward direction of the arrow is changed to that of the angle.

    So, if you're using a custom bow with a nock in an odd position or rotation, the forward direction could be messed up and the spine will get messed up.

    You can start by disabling "Look IK" to see if that's the culprit. If it is, you can change the IK Angles to better fit your skeleton and have a look at the bow setup. I talk about that in the User's Guide on page 18.
     
  24. msik

    msik

    Joined:
    Dec 7, 2017
    Posts:
    11
    To expand on this. If I have a kick motion on my base layer and the rest of my melee attacks are on my Upper layer how can I prevent the kicks and melee from interrupting each other? With "Override Layers" enabled on kick, it gives the desired behavior of nothing interrupting kick, but how can I prevent the opposite as well? I tried checking the base layer motion in the melee motion scripts TestInterruption(...), but while it initially prevents the interruption the kick motion FOA is still happening and part of the kick happens near the end of the melee motion. Like the KickMotion.Activate is called() it just doesn't interrupt the animation at first.

    Code (CSharp):
    1. var baseMotion = mMotionController.MotionLayers[0].ActiveMotion;
    2.  
    3. if (baseLayerMotion is KickMotion) return false;
    edit: Solved. checked for the opposite in TestActivate() of Kick
     
    Last edited: Jun 9, 2021
  25. msik

    msik

    Joined:
    Dec 7, 2017
    Posts:
    11
    Swapping cameras while moving breaks the input values and input magnitude. You can test this in the "demo_MotionController" scene.
     
  26. msik

    msik

    Joined:
    Dec 7, 2017
    Posts:
    11
    Another issue I'm experiencing: activating a camera motor transition through code (p28: https://ootii.com/Unity/CameraController/CCUsersGuide.pdf) and then activating another one by using the typical key input is breaking the character controller as walking/running stops working.
     
  27. msik

    msik

    Joined:
    Dec 7, 2017
    Posts:
    11
    I think you already did this right? I can see that AttackProfiles have a property InventorySlotID. The only issue is that this property doesn't seem to be assigned to the player's attack style when the weapon is equipped. I managed to fix it by adding
    Code (CSharp):
    1. lStyle.InventorySlotID = lStyleDefinition.InventorySlotID;
    inside the second foreach loop of SetAttackStyles() of my custom version of BasicAttackProfilesReactor.

    edit: also needed to assign the owner to secondary weapon in BasicItemEquip on CreateItem(), otherwise the Attacker property will be null in WeaponCore
     
    Last edited: Jun 24, 2021
  28. ddesmond

    ddesmond

    Joined:
    Feb 9, 2010
    Posts:
    163
    Welcome back @Tryz , what is the effort to get motion controller to work with Game Creator?
     
  29. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    31
    @Tryz almost all of your assets needs to be updated new unity versions
     
  30. aggaton

    aggaton

    Joined:
    Jul 3, 2021
    Posts:
    16
    @Tryz I've added this package to my project, as soon as I do I get below errors:

    Code (CSharp):
    1. Assets\ootii\Assets\Framework_v1\Code\Input\UnityInputSystemSource.cs(4,19): error CS0234: The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
    2.  
    3. Assets\ootii\Assets\Framework_v1\Code\Input\UnityInputSystemSource.cs(5,19): error CS0234: The type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
    4.  
    5. Assets\ootii\Assets\Framework_v1\Code\Input\UnityInputSystemSource.cs(25,24): error CS0246: The type or namespace name 'PlayerInput' could not be found (are you missing a using directive or an assembly reference?)
    6.  
    7. Assets\ootii\Assets\Framework_v1\Code\Input\UnityInputSystemSource.cs(841,16): error CS0246: The type or namespace name 'Key' could not be found (are you missing a using directive or an assembly reference?)
    8.  
    9. Assets\ootii\Assets\Framework_v1\Code\Input\UnityInputSystemSource.cs(24,16): error CS0246: The type or namespace name 'PlayerInput' could not be found (are you missing a using directive or an assembly reference?)
    10.  
    11.  
    I assume that is because the new InputSystem is in use, probably by one of my other packages I have installed. How do I get your package to stop giving these errors so I can try and use it?
     
unityunity