Search Unity

  1. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

Motion Controller

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

  1. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    729
    OK, it's been a month since I originally asked this. I'd still like a response. As it stands, I can no longer use SMP for certain things that it used to work on. If this is something that isn't going to be fixed for whatever reason, I need to know so I can find another solution.

    I'm having a problem with the swimming pack when using volumes to define swimming areas. I remember this being an issue years ago, which was fixed, but now it seems to be doing it again. I was trying to use a box collider to define a swimmable volume, and couldn't get the player to rise to the surface. It seems that the "surface" is now set by the pivot point of the collider, instead of the upper surface plane of the box. Also, the player no longer knows when he's left the collider. Here's a comparison of Motion Controller 2.75, using SMP 0.63 vs 2.806 / 0.65.



    I used Unity 2018.2.5 for both tests, to eliminate any Unity upgrade issues between versions, but also confirmed this behavior on MC 2.804 / SMP 0.64 in Unity 2019.4.5. I couldn't try MC 2.75 in Unity 2019 since I no longer have an installer (and I'm not sure 2.75 would run without other issues in 2019 anyway). Any ideas? Is this a code regression, or do I need to set this up differently now?
     
  2. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    350
    I can't get this to work setting it using the mActorController.setPosition doesn't lift him and
    I can't seem to start a Coroutine from the within the motion ?
     
    Last edited: Aug 27, 2020
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @Gorkadread , I just replied to your email.

    Sending over the client's InputX and InputY would be right. However, you still may not get the exact position and rotation. That's because the server and clients run on different update cycles and the process things at different times. That's why networked games typically use authoritative servers. The clients then use the character's state, position, and rotation to mimic the server. What happens on a player's computer is an estimate for responsiveness, but the server wins.

    I'm definitely not an networking expert, but I know people have use the MC with Bolt and Unity's older networking solution. I haven't done that myself.
     
  4. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @FargleBargle ,

    I see what's going on. Somewhere along the line, I lost some features for water areas vs. water planes.

    I'm doing some testing and this works:
    1. SwimmerInfo.cs starting at line 217, change the "if" block to this:
    Code (CSharp):
    1.             // As a sanity check, let's see if we're really far under water
    2.             if (mWaterSurface != null)
    3.             {
    4.                 bool lUsePlane = true;
    5.  
    6.                 // TRT 08/29/2020 - Doesn't account for water volumes, but only planes. So, we'll use the hit information
    7.                 if (lHitInfo.collider != null && lHitInfo.collider is BoxCollider)
    8.                 {
    9.                     lUsePlane = false;
    10.                 }
    11.  
    12.                 if (lUsePlane)
    13.                 {
    14.                     lDepth = mWaterSurface.position.y - mTransform.position.y;
    15.                 }
    16.                 else
    17.                 {
    18.                     lDepth = lHitInfo.point.y - mTransform.position.y;
    19.                 }
    20.             }
    2. SwimmerInfo.cs line 349, change it to this:
    Code (CSharp):
    1. public bool IsAtWaterSurface(float rBuffer = 0f, bool rTestLastPosition = false)
    That worked for me and allowed the character to swim within the water area. Just remember that the "Surface Test" property on Swim - Idle motion will determine how far we test water for.

    I went back to code in 2018 and don't see any changes. So, I'm not sure at what point things changed. I'll keep looking.
     
    FargleBargle likes this.
  5. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    The AC.SetPosition(...) is working for me.

    Here's my full test. I put it in my Nav Mesh demo scene.

    Code (CSharp):
    1. using com.ootii.Actors;
    2. using com.ootii.Actors.AnimationControllers;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5. using UnityEngine;
    6. using UnityEngine.AI;
    7.  
    8. public class MoveUp : MonoBehaviour
    9. {
    10.     public ActorController mActorController = null;
    11.  
    12.     public MotionController mMotionController = null;
    13.  
    14.     public NavMeshAgent _navMeshAgent = null;
    15.  
    16.     public Vector3 _desiredPosition;
    17.  
    18.     // Start is called before the first frame update
    19.     void Start()
    20.     {
    21.        
    22.     }
    23.  
    24.     // Update is called once per frame
    25.     void Update()
    26.     {
    27.        
    28.     }
    29.  
    30.     private void OnGUI()
    31.     {
    32.         if (GUI.Button(new Rect(10f, 10f, 100f, 20f), "Go"))
    33.         {
    34.             mActorController.IsGravityEnabled = false;
    35.             mActorController.OrientToGround = false;
    36.             mActorController.FixGroundPenetration = false;
    37.  
    38.             if (_navMeshAgent != null) { _navMeshAgent.enabled = false; }
    39.  
    40.             _desiredPosition = mMotionController.transform.position;
    41.             _desiredPosition.y = _desiredPosition.y + 3f;
    42.             //mMotionController.SetTargetPosition(_desiredPosition, 3);
    43.             //mActorController.SetPosition(_desiredPosition);
    44.             StartCoroutine(mMotionController.MoveAndRotateTo(_desiredPosition, Quaternion.identity, 1f, true, true, false));
    45.         }
    46.  
    47.         if (GUI.Button(new Rect(10f, 30f, 100f, 20f), "Go Now"))
    48.         {
    49.             mActorController.IsGravityEnabled = false;
    50.             mActorController.OrientToGround = false;
    51.             mActorController.FixGroundPenetration = false;
    52.  
    53.             if (_navMeshAgent != null) { _navMeshAgent.enabled = false; }
    54.  
    55.             _desiredPosition = mMotionController.transform.position;
    56.             _desiredPosition.y = _desiredPosition.y + 3f;
    57.  
    58.             mActorController.SetPosition(_desiredPosition);
    59.         }
    60.     }
    61. }

    Make sure you disable the Unity's NavMeshAgent or it will take control.
     
  6. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    729
    That worked for me as well. Thanks!
    I hope this fix makes it into the next update, and you mark it "// Important: don't change - EVER" this time. :rolleyes:
     
    Tryz likes this.
  7. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    hahaha... will do. :)
     
  8. Zante

    Zante

    Joined:
    Mar 29, 2008
    Posts:
    424
    I'm having some trouble with foot sliding during the walk/run to idle transitions. I can't seem to figure it out as it looks as though the root animation is being disabled towards the end, which I assume is what's causing this to happen. I notice it also occuring in the web demo and made a quick video to highlight the problem. The way the legs move apart at the end, for my character, isn't the problem, it's the way - after running - that the feet slide back underneath the char. I'd love to fix it if I could as it's been bugging me a while.

    Any ideas?

     
  9. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    949
    This was probably never changed intentionally. I was pretty inexperienced with Git when I first started helping maintain and update the code base. With my understanding of branches at the time being stuck in the Subversion-era, I didn't quite grasp how to properly use Git branching. So I royally screwed up one time (spring 2019) when trying to revert a commit to the master branch, and a number of bug fixes were reverted as well. When I realized this (which unfortunately wasn't until a few weeks later), I tracked down those fixes in their original branch and re-applied them.

    So most likely, the fix to SwimmerInfo.cs was one of the changes that I accidentally reverted and I missed it when tracking down everything that I messed up. My apologies. :oops:

    I understand the Git workflow much, much better today and I never work directly off the master branch. :cool:
     
    FargleBargle likes this.
  10. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    949
    Sorry for the late response.

    It's been a very weird and stressful year in general (for most of us) and I started feeling very overwhelmed and burned out a few weeks ago. I didn't intend to just drop off the face of the earth for a month... just sort of lost track of how much time had passed since I had responded on this thread.

    I have not made an NPC navigate and then sit in a chair, although it is something that I have thought about as it is something that I would include in the game that I theoretically want to make (and haven't worked on for a very long time). I would probably build it with the Basic Interaction motion and using the interaction demo scene examples as a guide.

    I'm not totally sure how I would handle the NavMeshAgent here. If using the NMA, it can be difficult to achieve precise movement and turning on the spot (or without moving much) is a royal pain. But without the NMA, it's possible for objects to get in the way and block movement. Probably best to disable collisions with the character once they start performing the "sit down" interaction so that this can't happen while the character is moving into the correct position to start the "sitting down" animation.

    (The Behavior Designer integration was written by @Tryz.)
     
  11. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    949
    Is there a specific reason that you need to add the MotionController component at runtime? It makes the whole setup process exponentially more complex IMO.

    I've had no issues getting MC to work with UMA by setting it up at design time. The most important thing to remember is to run the UMA Bone Builder tool on the prefab (or the object that you use to make the prefab -- before creating a prefab from it) at design time. This lets the ActorController generate the necessary body shapes at design time.

    Once you've created a prefab or GameObject and built the skeleton using the Bone Builder, you can use the Character Wizard to configure your prefab with all of the necessary components. The CW is somewhat more opinionated than the setup methods that are in the individual component custom Editor code (as in it assumes a fairly conventional 3rd person action/adventure style of game and controls), but you can easily change those defaults after you have created the prefab(s) that you need.

    However, if you truly need to add the MotionController and related components at runtime, have a look at the files under ootii/Assets/MotionController/Code/Setup/Helpers -- CharacterSetupHelper.cs in particular. Most of the methods in these helper classes are contained within #if UNITY_EDITOR directives, but you should be able to adapt the code to your needs. You can also dig into the code for the Character Wizard (specifically ootii/Editor/MotionController/Setup/Profiles/CharacterWizardProfile.cs), as this contains similar code for adding and configuring the components. The CW code was written somewhat later and does duplicate some of the functionality of the "SetupHelper" code, but is also a fair bit more advanced. Between the two sources, you should be able to find code examples that you can adapt to handle any runtime setup of the components.
     
  12. Gorkadread

    Gorkadread

    Joined:
    Mar 27, 2013
    Posts:
    7
    Evening!
    This is most likely a stupid question but I can't seem to find how to activate a characters sprint in code... I set the ProcessUserInput() of MotionController manually which let's the character walk, but how would I go about activating sprint in code? :) ActivateMotion isn't right since it's the same motion, only faster, right?
     
  13. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    350
    Hey everyone i am trying to make my character fight with melee (when there is no weapon) however i am not quite sure to do this with attackprofiles ect.

    HOw do you make the "default" to be to fight with fist/ melee
     
  14. frankcarey

    frankcarey

    Joined:
    Jul 15, 2014
    Posts:
    9
    I'm attempting to implement a lift and carry motion on an NPC. I've been working with the MC for a few weeks and read through the MC pdf, but it doesn't really cover how one would tie two motion layers together. I've also been just reading the code and using the Rider debugger to step through to better understand before reaching out.

    I was looking to have a pickUp animation on layer-0 (locomotion/base) and then as soon as that completes to trigger the carry-idle as an override in layer-1 (upper body) and have it stay in that state until it's time to trigger it to complete. Looking in the animations/motions provided with the MC, I don't see any use of layer-1 and again the docs don't really seem to cover it.

    I WAS able to basically get this working as a prototype using the node canvas integration and the Simple Motion "meta" motion (thank you for making those btw), but I'm seeing a couple issues with that:

    1) Seeing some obvious pops as we transition from carry to empty on layer-1 and from drop-> Idle on layer-0 states. I'm thinking I may need to eliminate the exit-time so the upper body layer uncarry happens immediately, but it feels I should just approach this by writing a proper motion to deal with this, but I'd love to see an example of one where layers are coordinated. I'd be open to buying the FPS motion pack if it was necessary as I think that's how you are doing the gun holding there, but I'd prefer some dead-simple example of that behavior included in the docs or example motions (maybe I missed something?)

    2) I'm also seeing some strange behavior where the last "drop" motion gets stuck. That uses the "Simple Motion" motion and the node canvas "Activate Motion" to activate the drop animation. The animation completes in the SM, it returns to idle, but the MC debugger is showing the PhaseID is still stuck on that number and that the motion is still active for some reason. Stepping through the Rider debugger it seems in
     TestUpdate() 
    when it checks
     if (mHasEnteredAnimatorState)
    , it evaluates to false and keeps returning TRUE.. finding it hard to understand how the animator controller state changes get consumed by MC.

    3) In Simple Motion - what exactly is Exit State supposed to do? I get that it references the full "path" of my animation controller state and having the example in the docstring is super helpful, but I'm still unclear what it's supposed to do and what it would be used for.

    Lastly - I found the help message of "Motion could not be found." on the Node Canvas integration to not be super helpful to debug, so I made it a little better and I'm attaching a simple patch to say what motion it can't find and what layer it can't find it on. Also I found it a little confusing that I need to name the motion vs using the Action Alias to get that to work, but it makes sense now.
     

    Attached Files:

  15. frankcarey

    frankcarey

    Joined:
    Jul 15, 2014
    Posts:
    9
    Another issue with the ActivateMotion.cs in the Node Canvas integration: It seems that the Node Canvas starts before MC (or at least the Simple Motion) is fully activated? I get an error that the motions can't be found if Activate Motion action is the very first thing that's run, but I avoid the error if I add a 1s WAIT action before it. Any ideas on how to resolve that as well?
     
  16. frankcarey

    frankcarey

    Joined:
    Jul 15, 2014
    Posts:
    9
    Ha, one last one that's been bothering me. I'm using the A-star Pathfinding asset and I wrote up an integration to drive the MC based on the values I get from that. I'm running into an issue where I want the NPC with the MC on it to slow down a bit as they approach the destination, but as soon as the input Magnitude drops below 0.3 on the walk-run-pivot motion, the root motion walk exits and the character stops moving just before they reach the destination. Any advice to enable the character to finish advancing?
     
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Unfortunately, it's expected due to animation blending. When animations are blended together (like a walk and an idle), Unity also averages the root motion and the character's root position. This averaging can cause what you're seeing. The only way I've found to get rid of it is to not use Unity's animation blending.

    You can do this when you've got an animation package that is built to work together. In this case, the animations don't blend, but perfectly line up with each other. The animation are timed to go instantly from one to another. In this way, there's not animation blending and there's no averaging of the root-motion or character's root position.

    Kubold's animation do this nicely. However, Unity's animations (which I use with the MC) and Mixamo's require animation blending.

    BTW, this isn't just with the Motion Controller. It's true for any asset that uses Unity's Mecanim and blends animations.
     
    Zante likes this.
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @Gorkadread ,

    To do this through code, you want to send the "normalized speed":
    0.0 = idle
    0.5 = walk
    1.0 = run

    There's a property "MotionController.TargetNormalizedSpeed". Setting that will change how the character moves. Just make sure to default the character to "run" on the BasicWalkRun<xxx> motion.

    Check out the NavMeshInputSource.cs and you'll see a property called "_NormalizedSpeed" and how I use it (line 802). That should give you a good example to follow.
     
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    You really want to treat the fists like any other weapon. Just like a sword, have colliders that represent the fist hits and "equip" them just like a weapon.

    I did this with the Ripper demos where I had the dog use it's mouth like a weapon.

    These videos should help. Just make the character hold an invisible "weapon".



     
    Censureret likes this.
  20. Gorkadread

    Gorkadread

    Joined:
    Mar 27, 2013
    Posts:
    7
    Hey again!
    Debug.Log of the TargetNormalizedSpeed on my character shows that it's currently set to 1.0 all the time, so I guess what I need to do is what you mention about defaulting the character to run on the BasicWalkRun<xxx> motion. How do I go about that? Is it possible to just toggle that from code?

    Edit: Nvm, I found the checkbox :)

    Thanks for your time Tim!
     
    Last edited: Sep 6, 2020
    Tryz likes this.
  21. reinaldf

    reinaldf

    Joined:
    Nov 24, 2017
    Posts:
    4
    upload_2020-9-10_9-19-5.png

    moving left (arrow or A) gives InputY value which supposedly not. Where should I fix this?
     
  22. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hi @reinaldf ,

    It looks like you're using my "demo_TopDown" scene which uses my "Basic Walk Run Focus" motion for top-down style games. However, the animator is using "WalkRunRotate v2-SM" which is used for more World of Warcraft style games.

    Go head and email tim@ootii.com with your Invoice ID and let me know what you're trying to create. Then, I can help point you in the right direction.
     
  23. Tzirrit

    Tzirrit

    Joined:
    Sep 9, 2014
    Posts:
    19
    Using the S&S Pack, my player character cannot block enemy attacks in the build version.

    Everything works fine in editor, in the build the blocking motion does happen, but the player still takes damage.

    I am using a custom block motion. Sword and shield use the FoA approach and are set up correctly. I've tested it with both colliders and FoA setup (for both shield and sword) and neither do block the attack in build mode.

    Edit:
    I narrowed it down to the OnMessageReceived method in my custom block motion, which is a copy of the default block motion:
    Code (CSharp):
    1. if (lIsBlockable && mMotionLayer._AnimatorStateID == GetStateID("Block Idle Pose"))  { .. }
    AnimatorStateID: -1753053940 ?= -1895393729


    The "Block Idle Pose" StateID returned by GetStateID is different in the build and therefore the rest of the code is never executed. In the editor, the stateIDs do match (both are 1753053940). Any Idea how this can happen?
     
    Last edited: Sep 15, 2020
  24. WithinAmnesia

    WithinAmnesia

    Joined:
    Oct 31, 2016
    Posts:
    20
    Hello! I am looking to create a RPG with physics based combat (akin to Mount & Blade, Dark Souls etc.).

    I have been trying to use Invector for a few years now although there is a resistance to develop any RPG elements for their Third Person Controller. I only found this controller just today after looking through all of the Unity Asset store's system templates.

    I am wondering if this controller can deliver the same engaging combat offered by Invector's melee controller although with RPG elements, like magic, attributes, experience and levels. I have the option to go 'into the wilderness' and try and find (a) coder(s) to fund to add RPG elements to Invector's third person controller; or perhaps ask around here and perhaps instead use the array of tools offered by this controller (if they are powerful enough which I hope XP). Although I am wondering if there is any active development for this third person controller and if I can even talk to the developer(s) and ask for feature commissions. I say this for the last public video was released around a year ago https://www.youtube.com/c/Ootii/videos (it seems that videos are ~usually made for major features).

    I seem to be late to the party although I am wondering if the community has any insight on the power of this character controller to build a RPG with physics based combat (akin to Mount & Blade, Dark Souls etc.)?

    I have the ability to fund new features and coding for a conservative estimate of at least $500-1000 a month for the next 4-6 months.

    I am mainly looking for help and the right people to build with. I am a bad coder I will just put that out there to start although I have a long story of trying to make a RPG worth playing with various different engines for over a decade now and I have killed at least 4 RPG prototypes off because they were too weak and I was not happy with myself for working on them when I knew I had do better. If anyone wants to talk with myself regularly I am on Discord frequently for I am also making a Unity 3D physics based tank game and that is where my developer friends congregate. Although I am having a hard time finding developers who want to work on a RPG; thus why I am here :p. You can find myself on Discord as Matthew#3194 .
     
  25. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    949
    @WithinAmnesia - sent you a friend request on Discord. I'd like to get some more in depth info as to what your looking for.

    RPGs are totally my thing. :cool:
     
    Tryz and KillerKahuna like this.
  26. KillerKahuna

    KillerKahuna

    Joined:
    Jun 19, 2013
    Posts:
    72
    Hi @Tryz and community friends ;)
    I've been a long time follower and had been hoping to use the motion controller for my projects.
    Now I've finally gotten around to doing so and I've gone over and implemented your approach to animations to a more sophisticated Idle Animation and everything seems to work correctly with my newly added ViewX and ViewY Fraction variables.

    However I have been stumped for the last two days trying to debug an issue where my
    Mechanim Animator doesn't want to jump out of a blend tree properly eventhough Deactivate gets called properly upon having an InputMagnitudeAverage of zero for 1/5th of a second.

    I've recorded the issue to try and mitigate this faster with your help
    because I literally have to brute force it by checking the animators lhash value in the WalkJogSprint Motion's TestActivate() and after multiple runthroughs it does jump to the Idle Pose provided in the WalkJogSprint SM.


    At the 0:30 timestamp you see the issue of the motion not deactivating correctly,
    followed by the proof that the Motion controller is actually in the idle motion and updating the ViewX and ViewY values with the corresponding Phase values.

    Yet at 01:01 you can clearly see if the blendtree has to start over and the animation doesn't get to loop around the blendtree exits as expected. Perhaps it's of interest to note that I am using your implementation of SmoothInput.
    However I cannot see a co-relation between the SmoothInput and this bug.

    Because here it proves that the Mechanim Animator is still going through the animations in the blendtree
    while the Motion controller is actually running the proper functions of the Idle Animation setting the Phase values to my look direction Phase values.

    Not only this, I can circumvent this bug by not applying Input over the MotionTime of 1.0.
    You see this when the mechanim animator jumps between WalkJogSprint SM and Idle SM after only setting one step in the motion taking about 0.2 in the animations lifetime.
    So when none of the animations get a chance to loop more than once inside the BlendTree,
    the behaviour of the blendtree and the motion controller work as intended.

    I am hoping to get your help on this jarring issue, even though I dabble in code at an amateur level I am not a fan of visual scripting and mechanim has been the learning curve rather than your wonderfully commented code.

    But I honestly can't for the life of my figure out a way to make sure the Mechanim Animator jumps out of the blendtree when the deactivate gets called on the Motion where the MotionPhase gets changed.
    Mechanim just doesn't adhere to this command where the values change.

    Code (CSharp):
    1. public override bool TestActivate()
    2.         {
    3.             if (!mIsStartable) { return false; }
    4.             if (!mMotionController.IsGrounded) { return false; }
    5.  
    6.             int lHash = Animator.StringToHash("HC-Locomotion.HC-WalkRunSprintStrafe-SM.MoveTree_Strafe");
    7.             if (mMotionController.State.AnimatorStates[mMotionLayer._AnimatorLayerIndex].StateInfo.fullPathHash == lHash)
    8.             {
    9.                 mMotionController.SetAnimatorMotionPhase(mMotionLayer._AnimatorLayerIndex, PHASE_STOP);
    10.              
    11.                 if (_ShowDebug)
    12.                     Debug.Log("Animator is looping in STRAFE BlendTree, find a way to get out of it on Deactivate!");
    13.  
    14.             }
    15.          
    16.         }
    And so after mutliple calls on TestActivate() of the walking motion where I force the Phase to shift to the Idle Pose in the walking Motion it goes there but then never goes back to Idle because the motion is long deactivated because setting PHASE_STOP in TestUpdate() or Update() doesn't set this correctly.

    Any help is much appreciated, thanks in advance.
     
    Last edited: Sep 17, 2020
  27. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @Tzirrit ,

    The GetStateID(...) function uses Unity's Animator.StringToHash(...) function where I create the state name using the animator layer name. It's it's grabbing the state from a different layer than what you're expecting. So, if your state machine is on a different layer, the hash value from Unity would be different.

    You may want to try using Unity's Animator.StringToHash(...) function directly instead of my GetStateID(...) this way you can ensure you're pointing to the right animator state. Unity wants the state name like this:

    string lStateName = string.Format("{0}.{1}.{2}", mMotionLayer.AnimatorLayerName, _EditorAnimatorSMName, rState);
    return Animator.StringToHash(lStateName);
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @KillerKahuna , I'll PM you.
     
    KillerKahuna likes this.
  29. Tzirrit

    Tzirrit

    Joined:
    Sep 9, 2014
    Posts:
    19
    Thanks @Tryz , you pointed me in the right direction.

    _EditorAnimatorSMName was not set in the built, so the full state name was incorrect (missing the motion).
    Code (CSharp):
    1. #if UNITY_EDITOR
    2.             if (_EditorAnimatorSMName.Length == 0) { _EditorAnimatorSMName = "RPG-MeleeBlock-SM"; }
    3. #endif
    I noticed that setting _EditorAnimatorSMName only happens when in the Editor. Did not think about it before, and just copy&pasted it from the template. I am now always setting the state name and now it also works in the build ;)

    Is there a reason it is only set when in the Editor?
     
  30. KillerKahuna

    KillerKahuna

    Joined:
    Jun 19, 2013
    Posts:
    72
    Appreciate all the help I can get, thanks Tim, I'll get back to you ASAP.
     
    Tryz likes this.
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    A while back, Unity didn't expose the name at run-time. It was only the hash. So, I had to track it myself. That may have changed.
     
    Tzirrit likes this.
  32. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    350
    Hey guys have anyone every made a more detailed jump motion than the (BasicJump) I have a lot of animations but was wondering if anyone had some more advanced code for such a motion
     
  33. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @Censureret , I'm not sure what you mean by "more detailed jump", but check out my "Jump" motion (not just Basic Jump). I built this one originally and it could handle things like a block sliding under you mid-jump. You could create a super huge jump and the phases would adapt to account for different jump heights or objects sliding under you mid-jump.

    However, it didn't do things like double-jump or wall-to-wall jumps.
     
  34. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    458
    Hello there,
    I'm having an issue in build mode.
    I'm using Unity 2020.1.6 and the latest version of AC/MC from the store
    I'm also using the Rewired integration if that matters

    In Editor, everything is fine.
    In build the player is frozen and I'm having 2 of the same error once (sorry it's from the player log so it's not as readable as from the console - and from the console I don't have the full trace):

    Code (CSharp):
    1. FormatException: Input string was not in a correct format.
    2.   at System.Number.ParseSingle (System.String value, System.Globalization.NumberStyles options, System.Globalization.NumberFormatInfo numfmt) [0x00083] in <fb001e01371b4adca20013e0ac763896>:0
    3.   at System.Single.Parse (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00000] in <fb001e01371b4adca20013e0ac763896>:0
    4.   at System.Single.Parse (System.String s) [0x0000b] in <fb001e01371b4adca20013e0ac763896>:0
    5.   at com.ootii.Geometry.Vector3Ext.FromString (UnityEngine.Vector3 rThis, System.String rString) [0x000a9] in \Assets\__Asset Store\ootii\Assets\Framework_v1\Code\Geometry\Vector3Ext.cs:484
    6.   at com.ootii.Actors.AnimationControllers.MotionControllerMotion.DeserializeMotion (System.String rDefinition) [0x002b2] in \Assets\__Asset Store\ootii\Assets\MotionController\Code\Actors\AnimationControllers\MotionController\MotionControllerMotion.cs:1335
    7.   at com.ootii.Actors.AnimationControllers.MotionControllerLayer.InstanciateMotions () [0x001cd] in \Assets\__Asset Store\ootii\Assets\MotionController\Code\Actors\AnimationControllers\MotionController\MotionControllerLayer.cs:829
    8.   at com.ootii.Actors.AnimationControllers.MotionControllerLayer.LoadAnimatorData () [0x00001] in \Assets\__Asset Store\ootii\Assets\MotionController\Code\Actors\AnimationControllers\MotionController\MotionControllerLayer.cs:383
    9.   at com.ootii.Actors.AnimationControllers.MotionController.LoadAnimatorData () [0x0001e] in \Assets\__Asset Store\ootii\Assets\MotionController\Code\Actors\AnimationControllers\MotionController\MotionController.cs:2624
    10.   at com.ootii.Actors.AnimationControllers.MotionController.Awake () [0x00478] in \Assets\__Asset Store\ootii\Assets\MotionController\Code\Actors\AnimationControllers\MotionController\MotionController.cs:789
    I narrowed it down to what it shows in the log, in an helper script from the Framework V1 folder.
    This method:
    Code (CSharp):
    1. public static Vector3 FromString(this Vector3 rThis, string rString)
    So what made my troubleshooting easier, is that there is a comment:
    Code (CSharp):
    1. // We're trying to account for when the value is serialized as '12,789.12,789.12,789' as opposed to the US serializing as '12.789,12.789,12.789'
    My regional settings are set to French.
    I went away and changed them to American English, no more errror.

    While it could be a solution, obviously it is not as you can imagine it has to work with any regional settings

    I made 2 screenshots of the differences from French and U.S settings:
    upload_2020-9-24_0-6-6.png
    upload_2020-9-24_0-6-13.png

    I tried just changing the decimal and grouping to "." and "," in the French settings: this didn't work. so I suspect it's something else

    But anyway I doubt the fix if there is any should come from the user changing regional settings to not have an error

    Is it something anyone would have an idea on how to fix it? I don't want to post the full method from the helper script here as it may be not allowed to share it as it's part of AC/MC

    Thanks by advance for your support!
     
  35. YorkshirePudding

    YorkshirePudding

    Joined:
    Apr 10, 2013
    Posts:
    18
    Hi All,

    I'm pretty new to the motion controller, I love what I see. I just wondered if somebody could help me with this basic question, please?

    I have my character setup and working via the nav mesh input source, it works great. The question I have is that I cannot get it to move if I use the standard NavMeshAgent path and destination assignments. For example, using the basic navmesh agent (outside of MC) you could just set _navMeshAgent.destination = xyz but the MC doesn't seem to react to this. Instead, I have to set the target on the input source to make it react and start moving.

    I'm currently under the impression that this input source component is supposed to read the values from the navmesh agent component and react accordingly. Of course, I could be wrong, hence I'm asking here.
     
  36. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    350
    Hey guys. have anyone ever made a stable integration between puppetmaster and ootii character controller?

    I have attempted several times but it always resulted in some odd glitches. Now i have a usecase where i am throwing a spear at my enemies and puppet master could really really do a lot of good here but i can't get it to work. i have even attempted the "ootii puppet" script but it is just not working for me.

    Can anyone help me as this is really really important to my project
     
  37. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    A while back Partel (Puppet Master owner) had created an integration. You might be able to find some old code. I couldn't find it directly, but maybe on his forums.

    Unfortunately, I haven't used Puppet Master myself.
     
  38. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @WolfSheep ,

    You're right about the "Nav Mesh Input Source" (NMIS) reading values from Unity's Nav Mesh Agent (NMA). Basically, the NMA tells the NMIS what the direction is of the movement. The NMIS turns that into pseudo-input and sends that to the MC. The MC then plays the animations that cause the character to rotate and move.

    To do this, the NMIS needs information about the destination and it controls the NMA. So, you just set the target on the NMIS and it sets the destination on the NMA. The NMA becomes invisible to you as the NMIS and MC handles it.
     
  39. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    Hey @Necka_ , I'm looking at this now. However the statement "In Editor, everything is fine." always scares me as Unity should processing things the same at editor-time or run-time.

    What is your Api Compatability Level set to? Can you email tim@ootii.com a screen shot of your "Player" settings.

    A while back there was a Unity bug where .NET 4.x didn't support Unity's localization settings. However, I thought that was fixed.
     
  40. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    949
    The .NET 3.5 scripting runtime was deprecated in Unity 2018.3 and removed entirely in 2019.2.

    The API Compatibility Level option just switches between the full .NET 4.x feature set and the .NET Standard 2.0 subset. Unity 2019.2 and later are always using the .NET 4.x equivalent scripting runtime, regardless if the API Compatibility chosen.

    Most likely I messed up when I updated the serialization code.
     
  41. PeteOfThePetes

    PeteOfThePetes

    Joined:
    Sep 2, 2019
    Posts:
    4
    So... I hate to ask this because it's probably something simple, but after searching online and messing around with it for the last 5 hours... I'm just lost.

    Bellow you can see I have a set of animations from Clazy Runner that I want to use (Gif 2), but you can see that in the general walking animation included with the Ootii MC (Gif 1), the animation is actually moving across the ground (You can see the grid motion as it walks) But the Clazy Runner animations do not.

    The result of swapping out the animations is that they play perfectly but the character wont actually move (Gif 3). I am literally losing my mind. Is there a way to get the character to move!? I was really hoping just swapping the animations would have worked..

    Any help would be greatly appreciated!
    Thank you!
    Pete

    Animated GIF-downsized_large (1).gif Animated GIF-downsized_large.gif Animated GIF-downsized_large (2).gif
     
  42. YorkshirePudding

    YorkshirePudding

    Joined:
    Apr 10, 2013
    Posts:
    18
    Hi Tim,

    That makes sense, thank you for the clarification and reply.
     
  43. YorkshirePudding

    YorkshirePudding

    Joined:
    Apr 10, 2013
    Posts:
    18
    I'm pretty new to MC, so forgive me if I'm wrong here, but..... if the only difference is the actual animation, then that would suggest that root motion is not present in the new anims and your character is set to use them.
     
    Tryz and PeteOfThePetes like this.
  44. PeteOfThePetes

    PeteOfThePetes

    Joined:
    Sep 2, 2019
    Posts:
    4
    Oh my god! Thank you! All I did was switch out the animations for the Root animations and it's working perfectly hahaha Thank you so much!
     
  45. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    103
    Hi, I just started with the motion controller, and am also using your camera controller. I am working on a scene where we disable the player temporarily. It seems that when the player is re-enabled either the motion controller stops controlling the player, or the camera controller stops following the player. We've seen both happen, but I haven't gotten to the bottom of what is causing which behavior yet.

    In the meantime, do you have guidance on how to properly enable/disable your components that I could implement?
     
  46. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    103
    I also noticed that with the MMO style controller you can't walk and turn at the same time. Is this by design, did I set something up wrong, or maybe a bug?
     
  47. Skotrap7

    Skotrap7

    Joined:
    May 24, 2018
    Posts:
    103
    I resolved my issue with enable/disable buy just enabling/disabling the motion controller itself.

    Still curious about the walk and turn issue. Hold W and while walking, press A. Nothing. Works fine if I use the mouse right-click and turn, would expect the same thing with the W and A keys together.
     
  48. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    350
    Hey is there any way i can use the new unity input system with the motion controller? :)
     
  49. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,382
    We'd have to create an Input Source for Unity's new input system.

    I've started looking into the new input system, but it's more complex than I expected. So, while it's definitely doable, I just need to dig into the input system more.

    This is exactly why I went with the "Input Source" approach. I (or anyone) just needs to learn the system and create the wrapper. I'm looking into it during my time off (which is scarce right now). :(
     
  50. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    350
    The input system is an interface that is too simple for the new very advanced unity input system. I am working on some way around it using unity events however i am not sure each motion / motion controller can reach it i will let you know my progress
     
unityunity