Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Motion Controller

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

  1. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    When people have reported this before, its been one of two things:

    1. They have a RigidBody attached and have not checked IsKinematic and unchecked gravity.

    2. The root of thier characters is not at the feet.

    Can you confirm these are good?

    Another good check is to use my demos scenes and test a jump. If it works there, then it is just a setting.
     
  2. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    109
    I am in the process of creating custom animations to work with the deer from Malbers Animations and I have ran into a small issue and was hoping that someone could point me in the right direction. I have recreated Malbers locomotion state machine in a manner that is compatible with Ootii's controller. Basically, I changed the inputs on the states to match the inputs for ootii and scaled down the values from between -2 and 3 to -1, 1. Everything works great and as I want it to if I control the deer. When I attach the NavMeshInput Source everything works well also, until the target reverses direction and becomes immediately behind the moving deer. The simulated input basically becomes 0,-1 which puts the deer into walking backwards. What I would really like is for the deer to possibly get an input of -1,0 or 1,0 which would cause him to turn 180 degrees until walking/trotting/running forward becomes more natural.

    Here is an unedited version of the video showing what is going on.



    Inside of the NavMeshInputSource i have found this method.

    Code (CSharp):
    1.         protected virtual void SetDestination(Vector3 rDestination)
    2.         {
    3.             if (!mHasArrived && mAgentDestination == rDestination) { return; }
    4.  
    5.             // Reset the properties
    6.             mHasArrived = false;
    7.  
    8.             // Set the new destination
    9.             mAgentDestination = rDestination;
    10.  
    11.             // Recalculate the path
    12.             if (mIsPathValid && !mNavMeshAgent.pathPending)
    13.             {
    14.                 mIsPathValid = false;
    15.  
    16.                 mNavMeshAgent.updatePosition = false;
    17.                 mNavMeshAgent.updateRotation = false;
    18.                 mNavMeshAgent.stoppingDistance = _StopDistance;
    19.  
    20.                 mNavMeshAgent.ResetPath();
    21.                 mNavMeshAgent.SetDestination(mAgentDestination);
    22.  
    23.                 mFirstPathSet = true;
    24.             }
    25.         }
    I am not sure if i need to recalculate a new target, or if i should go into the SimulateInput method and monitor for an input of 0,-1 (or something close with a fudge factor) and change the input so that i can get (-1, 0) or (1,0) until the deer is facing the correct direction.

    Does anyone have any suggestions or ideas? No rush on an answer as I have all the other non locomotion animations to create also. I am using the basic motions where possible and creating new ones when needed.

    Another possibility would be to move the turn around animations closer to the walk backward animation in the sub state machine. This would probably mean that I would not have a straight walk backwards animation but I do not see a need for that in my AI.

    ** EDIT **
    Thinking about it on the way home from work, I am pretty sure that the best way to do it would be to modify the input in the NavMeshInputSource, in the same way that SimulateStrafeInput works.
     
    Last edited: Jul 31, 2019
    Tryz likes this.
  3. zlyka1004ka

    zlyka1004ka

    Joined:
    Sep 13, 2018
    Posts:
    5
    why is my character hanging above the ground, feet not touching. Unity 2019 upload_2019-7-31_0-28-25.png upload_2019-7-31_0-28-57.png upload_2019-7-31_0-28-37.png
     
  4. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    109
    It looks like from your images that the Body Shapes from the Actor Controller extend below your characters feet. If you go into the body shapes section of the actor controller and select the shape that corresponds to the one in your image, you can modify the offset Y position to move it up.
     
  5. zlyka1004ka

    zlyka1004ka

    Joined:
    Sep 13, 2018
    Posts:
    5
    on stage everything is fine as soon as I start it turns out what that blue sphere upload_2019-7-31_21-5-2.png
    upload_2019-7-31_21-3-14.png
     
  6. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    215
    Hey guys. @Tryz how do i add effects on shield impact (just like we have sound) ?
     
  7. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    That's pretty cool! :D

    WOW... that looks amazing!

    Exactly.

    Nav Mesh Input Source is just a fancy input source. So, what really matters are the properties like:
    InputFromCameraAngle
    InputFromAvatarAngle
    MovementX/MovementY
    ViewX/ViewY

    So, in SimulateStrafeInput() or SimulateInput() you would change these properties as you need to get the effect you want. So, even though the direction is directly behind your deer you would modify the properties to force an off-to-the-side turn that is as tight as you need. How much depends on the animator transitions that force the natural looking turn animation to occur.


    MAJOR props to you for doing this. It looks amazing!
     
    KeithBrown and TeagansDad like this.
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    This has to do with re-targeting animations and can be fixed by "sinking" your character.

    "on state" (meaning at edit-time), no animations are playing. So, the character is placed exactly on the "root".


    At run-time, animations play. That means that the character's bone rotations are based on the animation and skeleton the animation was created on. It is probably NOT the skeleton your character's body was created on. So, think about what happens in an animation...

    The root stays the same, then the hip bone is evaluated, then the upper leg bone is evaluated based on the rotation, then the lower leg bone is evaluated, etc.


    So, if the skeleton the animation was based on has a hip bone placed higher than your body's skeleton, the center of your character is higher (above the root). If the leg bones of the animation skeleton aren't exactly the same size as the body skeleton leg bones, your feet will end up in a different place too.

    If the animation skeleton is the same as the body skeleton, you don't have issues because the hips and bones are exactly the same size. In the indie game developer world, we don't typically have that luxury. ;)

    Hopefully that makes sense. How do you fix it?

    You just create an extra GameObject and parent your body in that. Then, you "sink" or "raise" that extra GameObject to get the precision you want.

    For example, in my "demo_Climbing" scene by default there is no extra GameObject and you get the images above. Here's what the hierarchy looks like:


    If I add the extra GameObject (called Body), here's what it looks like:


    Now, you can set the transform for the "Body" to account for any skeletal issues:


    The result:


    BTW, this doesn't have anything to do with the Motion Controller or my assets. It's just the way Unity's retargeting system works for animations. It's pretty standard.

    I hope that helps.
     
    KeithBrown and TeagansDad like this.
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    Inherit from ShieldCore.cs and in the OnHit() function, add logic to trigger your effects. Then, your shield would use Censureret Shield Core instead of my simple Shield Core. I like this approach best because you can do anything you want... play effects, teleport the character, destroy the shield, etc.

    I probably could have made this easier by putting an event on the Shield Core. Then, you'd just add a function. I'll but it on my to-do list, but it doesn't exist today.
     
    KeithBrown and TeagansDad like this.
  10. zlyka1004ka

    zlyka1004ka

    Joined:
    Sep 13, 2018
    Posts:
    5
    wow man, thx a lot
     
    Tryz likes this.
  11. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    215
    Hey @Tryz i am trying to resurrect my PC using the code you have provided in your online Q/A:

    Code (CSharp):
    1. IAttributeSource lAttributes = mMotionController.gameObject.GetComponent<IAttributeSource>();
    2. lAttributes.SetAttributeValue("Health", 120f);
    3.  
    4. mMotionController.enabled = true;
    5. mMotionController.ActorController.enabled = true;
    6. mMotionController.ActorController.AllowPushback = false;
    7.  
    8. mMotionController.ActorCore.IsAlive = true;
    9.  
    10. Collider[] lColliders = mMotionController.ActorCore.gameObject.GetComponents();
    11. for (int i = 0; i < lColliders.Length; i++)
    12. {
    13.     lColliders[i].enabled = true;
    14. }
    15.  
    16. if (mMotionController.ActiveMotion != null) { mMotionController.ActiveMotion.Deactivate(); }
    17. mMotionController.ActivateMotion(typeof(BasicIdle));
    However there is a problem. when the PC is ressurected he has no colliders. even if i run the above code.

    Do you know what might be the problem?
     
  12. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    780
    @Censureret -
    Assuming that you're using the BasicKilledReactor with its default settings (Remove Body Shapes and Disable Colliders), then you don't actually have any colliders to re-enable, as ActorController.RemoveBodyShapes() will destroy all of the associated Unity colliders. Unfortunately, this function also clears the serialized Body Shape definition data (currently -- this should probably be changed).

    For the time being, if you're only running in the Unity Editor and not making any builds, you can call the static function CharacterSetupHelper.CreateDefaultBodyShapes(MotionController rMotionController) to recreate the Body Shapes (and colliders) with their default values. If you need to be able to build the game, you can just use this code to recreate them:

    Code (CSharp):
    1. ActorController lActorController = rMotionController.GetOrAddComponent<ActorController>();          
    2.  
    3.             lActorController.BodyShapes.Clear();
    4.             BodyCapsule lCapsule = new BodyCapsule
    5.             {
    6.                 _Parent = lActorController.transform,
    7.                 Name = "Body Capsule",
    8.                 Radius = 0.3f,
    9.                 Offset = new Vector3(0f, 0.6f, 0f),
    10.                 IsEnabledOnGround = true,
    11.                 IsEnabledOnSlope = true,
    12.                 IsEnabledAboveGround = true,
    13.                 EndTransform = lActorController.transform.FindTransform(HumanBodyBones.Head)
    14.             };
    15.  
    16.             if (lCapsule.EndTransform == null) { lCapsule.EndTransform = lActorController.transform.FindTransform("Head"); }
    17.             if (lCapsule.EndTransform == null) { lCapsule.EndOffset = new Vector3(0f, 1.6f, 0f); }
    18.  
    19.             lActorController.BodyShapes.Add(lCapsule);
    20.  
    21.             BodySphere lSphere = new BodySphere
    22.             {
    23.                 _Parent = lActorController.transform,
    24.                 Name = "Foot Sphere",
    25.                 Radius = 0.25f,
    26.                 Offset = new Vector3(0f, 0.25f, 0f),
    27.                 IsEnabledOnGround = false,
    28.                 IsEnabledOnSlope = false,
    29.                 IsEnabledAboveGround = true
    30.             };
    31.  
    32.             lActorController.BodyShapes.Add(lSphere);
    33.  
    34.             // Save the new body shapes
    35.             lActorController.SerializeBodyShapes();
    When I get a chance, I'll look at revising how this works so that the Body Shapes can be restored at runtime from the serialized data. Won't be for at least a couple of weeks though.

    Also, Line 10 in the code you posted should use the <Collider> type constraint; otherwise you might be enabling components that you don't want to have enabled:

    Code (CSharp):
    1. Collider[] lColliders = mActorCore.gameObject.GetComponents<Collider>();
     
    Censureret and Tryz like this.
  13. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    215
    hey guys. is there a way to instantly kill an NPC?

    I have attempted the following but it doesn't work :(

    Code (CSharp):
    1.      
    2.                DamageMessage d = DamageMessage.Allocate();
    3.                 d.ID = CombatMessage.MSG_ATTACKER_ATTACKED;
    4.                 d.Damage = 5000;
    5.                 d.ImpactType = EnumImpactType.PIERCE;
    6.                 d.Recipient = mMotionController.gameObject;
    7.                 this.mMotionController.ActorCore.SendMessage(d);
    8.  
    It doesnt even give him the 5000 in damage as it should?
     
  14. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    215
    Nvm i figured it out. However i do have another question :) is there a way in the 3rd person character mode that i can always force the camera to be behind the player no matter what? (just like when he is in target mode (using the combatant) )
     
    Tryz likes this.
  15. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    215
    As follow up to show so something like this when i press backwards wont happen:

    upload_2019-8-10_22-8-50.png
     
    Tryz likes this.
  16. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    It depends on the camera solution you're using.

    If you're using my Camera Controller or my Orbit Rig, you can use the SetTargetYawPitch(0, 0, 0, false) function and it will force the position until you call ClearTargetYawPitch();

    There's also a SetTargetForward(vector3, 0, false) and ClearTargetForward() that you can use if you want to look at a specific direction. That's what I use in the combatant. In this case, I change the direction every frame in case the enemy moves.

    Other camera solutions will have their own approaches. If needed, you can also switch cameras to one that is simply locked behind the character.
     
  17. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    215
    @Tryz i am using your camera controller asset :)
     
    Tryz likes this.
  18. zlyka1004ka

    zlyka1004ka

    Joined:
    Sep 13, 2018
    Posts:
    5
    Hello, help me please implement a smooth turn on the GIF with your controller
     
  19. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    215
    Hey, guys so I am really struggling with getting my units to work on the terrain. and currently, I have the "flying issue thing"

    upload_2019-8-12_22-56-33.png

    sometimes if there is too much of a bump in the terrain which causes my agents to stay in this "falling" position. how can i avoid this?
     
  20. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    The primary culprit is probably a collider at the feet or a full body collider that is preventing your characters root from hitting the ground. Distance and 'is grounded' is determined from the root.

    There are some ground distance properties on the Actor Controller that may help too. I don't have the AC documentation in front of me, but check that out.

    The MC demos have some steep terrain that my character works on. Look at how those Body Shapes are built.

    [EDIT]
    If you're using a nav mesh, try enabling the "Height Mesh" option on the nav mesh. That creates a more precise nav mesh.
     
    Last edited: Aug 13, 2019
  21. Morphius68

    Morphius68

    Joined:
    Apr 5, 2014
    Posts:
    19
    Hi,

    Just importing the MotionController into a new Unity 2019.3.0 project and getting the following error:

    Assets/ootii/Assets/MotionController/Code/Setup/Helpers/UISetupHelper.cs(3,19): error CS0234: The type or namespace name 'EventSystems' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)

    There were a couple more too which I have fixed but can't figure this one - anyone help?
     
  22. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    109
    Does this link help?

    https://forum.unity.com/threads/err...ot-exist-in-the-namespace-unityengine.675295/
     
    Tryz likes this.
  23. Morphius68

    Morphius68

    Joined:
    Apr 5, 2014
    Posts:
    19
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    Unity 2019.3 is a beta version and not reliable. Sometimes beta versions don't include the full set of Unity namespaces that they do once the version is released.

    I've confirmed everything is fine in Unity 2019.2.

    Please use a release version of Unity. If you can't for some reason, you may need to modify the code to account for Unity's beta issues. In this case, you can comment out the following lines in UISetupHelper.cs:

    Line 3
    Lines 63 through 71

    Unfortunately, I've spent a lot of time dealing with beta issues only to find out they are fixed before release. So, I don't jump on these kinds of things unless they show up in production.
     
  25. Morphius68

    Morphius68

    Joined:
    Apr 5, 2014
    Posts:
    19
    Fair enough - its a new project I'm working on so can roll back a version. Thanks!
     
    Tryz likes this.
  26. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    109
    I should have thanked you sooner for the compliments. Thank you. Your assets make it pretty easy.

    So i had some spare time last night and revisited this project. I made quite a bit of progress on getting the rotation correct. What I did in the InputSource was monitor the angle between the avatar and the destination. If it was greater than 90 or less than -90 i set the forward/backward movement to 0 and forced the horizontal movement to 1. I also made changes to the rotation speed based on the animal speed since a rotation value that worked for walking absolutely did not work for running. I also added some editor controls to force the movement speed or let the AI control the speed. Overall I am liking what I have done so far. The video below just shows the Deer from Malbers but I have transferred the controls to other animals and gotten the same results. The overall goal is to have the same functionality that Malbers has with his control as well as learn the ins and outs of all of ootii's assets. They really are amazing.

     
    Last edited: Aug 13, 2019
    Tryz likes this.
  27. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    Really well done! That looks great.
     
  28. Censureret

    Censureret

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

    I have a very very odd bug where the camera suddenly gets stuck in one position and i am no longer able to move it.

    I have no idea what causes this issue but it happens all of sudden with no real consistency.

    Has anyone else had this issue and know how i might fix it?
     
  29. Asset-Ninja

    Asset-Ninja

    Joined:
    May 9, 2015
    Posts:
    12
    As for the localization/owerflow issue I finally know what is wrong: The "SimpleJSON.cs" file trys to parse the float as "invariantCulture" which is overall a good practice, but Unity on NON-US systems sends the floats with COMMA meaning the value is "0,3" instead of "0.3" and the float conversion with invariant culture fails, so the bounding volume radius goes to 0 by default. It is not the user, that sets the radius to 0 but the "AsFloat" function. I hope, I will finaly get a reply since noone answers my emails.

    upload_2019-8-22_20-36-25.png
     
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    This shouldn't be an issue as we worked through it with others about a year ago. I'll have to dig through those posts.

    You sent one email on the 22nd. I'll reply over the weekend.
     
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    I've never seen or heard of this. Can you send me more detail on the setup?
     
  32. Asset-Ninja

    Asset-Ninja

    Joined:
    May 9, 2015
    Posts:
    12
    Thank you very much! Yes, but the issue persists. I did a small workaround like this:

    Code (csharp):
    1.  
    2. string value = Value.Replace(',' , '.');
    3. .. TryParse(value)
    4.  
    And voila, there is no overflow and Radius 0 anymore. I am worried about Unity though: it seems as it passes the float values in a localized and not invariant form.
     
  33. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    780
    @Tryz @Asset-Ninja

    When I updated the float serialization, it seemed to resolve most of the issues, but there was still some odd behavior that was showing up for some international users that I wasn't able to replicate -- particularly with Body Shapes. I figured that if I was serializing the float data with invariant culture, then I should have decimal values using a period when I'm deserializing.

    I guess it's a case where a simple, direct method (replacing "," with ".") works better than trying to do it the official way. :)

    I'll look into this again in the next week or two.
     
    Tryz and Asset-Ninja like this.
  34. Asset-Ninja

    Asset-Ninja

    Joined:
    May 9, 2015
    Posts:
    12
    Yes. This happens on body shapes. But I do not understand why are we dealing with strings after all? Maybe some general algorithm generates JSON from the settings and then deserializes them. The thing is, that the string contains the COMMA value wich tries to get converted back to float. Something converted FLOAT to STRING WITHOUT invariant culture, and then it tries to deserialize it WITH invariant culture.
     
  35. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    780
    @Asset-Ninja - Unity's built-in serialization system doesn't support polymorphism, unless the class inherits from UnityEngine.Object (such as ScriptableObject or MonoBehaviour). So Body Shapes, Motions, Camera Motors, etc all use custom serialization to store the values for each item in the collection within a JSON string on the "parent" MonoBehaviour, which is then handled by the built-in Unity serialization.

    There weren't any issues with the .NET 3.5 scripting runtime, but they started popping up with .NET 4.

    I'm not sure why the string contains the comma value, as it should be using Invariant Culture when serializing. I'll do another thorough pass over the code and see if anything got missed.
     
    Tryz likes this.
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    As usual, @TeagansDad is exactly right about where there is custom JSON serialization.

    @Asset-Ninja when you're getting the error, is it one of my demo scenes or a new scene you're creating? If it's a demo scene and you replace the Body Shapes and then save the scene, does the error come back?
     
  37. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    780
    @Asset-Ninja - I think I found it.

    In BodyShape.cs, insert at line 348:

    Code (CSharp):
    1.                 else if (lProperty.PropertyType == typeof(float))
    2.                 {
    3.                     lStringBuilder.Append(", \"" + lProperty.Name + "\" : \"" + ((float)lValue).Serialize() + "\"");
    4.                 }
    This is right after handling the Vector4 type and before the Transform type. It was falling through to the default else clause which was simply a ToString() call. I made sure the x,y, and z of the Vector3 values were being serialized using a "." but I missed checking that the plain float value in BodyShape was getting serialized properly.

    There are 2 or 3 variations as to how the custom classes are serialized across the suite of products. Older classes like BodyShape, MotionControllerMotion, etc perform many of the string functions within their own serialization methods, while newer classes generally use common library functions in the JSONSerializer class. So there are a number of places where I needed to update the code. I'll do another pass to make sure I didn't miss anything else.

    The float.Serialize() extension method used above is found in SerializationHelper.cs; it simply returns ToString("G8", CultureInfo.InvariantCulture).
     
    Asset-Ninja likes this.
  38. Andysco

    Andysco

    Joined:
    Jul 10, 2019
    Posts:
    2
    Hey,

    I have a fatigue-system in my game, so that when the character runs, it loses fatigue accordingly. I'm using the characters movement speed to figure out if the player is running or not and that's working fine.

    I just can't figure out how to make it so that when the character runs out of fatigue, it goes back to walk- animation, and when its recovered enough fatigue, I should activate the run-animation again. I'm using WalkRunRotate_V2 for these motions. I figured I just need to activate / deactivate "WalkTree" / "RunTree" in the "Move Blend Tree" somehow, but that's not how it's done I guess.

    If someone here has done this before, or just knows how its done, could you please give me an example or just point me in the right direction here?
     
  39. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    780
    @Andysco - the various WalkRun motions use the InputMagnitude animator parameter to blend the walking and running animations. It's a normalized value where 0 = idle, 0.5 = walk, and 1.0 = run.

    This parameter is set in code by the Motion Controller. I'm not at a computer right now, and I don't remember exactly where it sets the parameter. But what you could do is cap the InputMagnitude value at 0.5 when the character is out of fatigue (so in an Update method somewhere, if InputMagnitude > 0.5, set it to 0.5) and then remove that constraint once the character has recovered.

    It probably wouldn't be too much trouble to add such a limit to the WalkRun motions in general (default to 1.0) to make it easier to slow down a character due to a heavy load, a slow spell effect, etc. I'll look into to doing that.
     
    Andysco likes this.
  40. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    Another way to do it is with a custom Input Source. The Input Sources and motions use the MovementY property to move the character forward. The value is -1 to 1 where -1 mess the S key is pressed, 1 means the W key is pressed and 0 means no key is pressed. 1 also means full speed (run). If you clamp the value to -0.5 to 0.5 that will mean walk.

    Very similiar to what @TeagansDad said but you do it in a custom Input Source.

    Search www.ootiigames.com for more on Input Sources.
     
    Andysco and TeagansDad like this.
  41. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    780
    I came across this excellent video that I wanted to share with everyone:

     
  42. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,557
    @Tryz Just wanted to say it's nice to see you back here on a regular basis.
     
    Tryz likes this.
  43. BillO

    BillO

    Joined:
    Sep 26, 2010
    Posts:
    58
    ootii-Motion-Controller.jpg

    Would the ootii Bone Controller fix the issues detailed in the attached image. It has been my experience that these issues are common to any character using the Motion Controller. I would also like to control the arm and hand position based on items added to the character. For example, if a canteen was added, the arm would swing around the prop instead of passing through it.
     
  44. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,224
    The Bone Controller will allow foot placement when walking, but not the others.

    The issues are common using any character animations that aren't built specifically for your character. This isn't unique to the Motion Controller.

    These are Unity avatar and animation re-targeting issues. When you import an animation or character, Unity creates an avatar that aligns the bones to create a skeleton. You see issues like these because the bone lengths and rotations are different between your character's skeleton and the character skeleton the animations were created with.

    Unity allows you to fix these by adjusting the avatar. So, you can modify the avatar you use with the animations and your character to widen his arm, legs, etc. The only other option is to have an artist create your character and animations using the same skeleton. However, most of us indie game developers can't afford that. ;)

    Check out Unity's Avatar documentation here too. There are videos on YouTube too. This is standard Unity work and it's specific to your character.

    (see links in the text above for Unity's pages on this)
     
    hopeful and TeagansDad like this.
  45. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    109
    I think you really need to adjust the animations to fix those. You might try. https://assetstore.unity.com/packages/tools/animation/umotion-community-animation-editor-95986 it’s free and works inside of Unity. Blender is also free but requires a bit more technical skill to achieve good results.
     
    christougher and Tryz like this.
  46. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    780
    Just want to let you guys know of a few things that should be coming soon:
    • fixed all import warnings for script (.cs) files
    • added AnimationCurve as a serializable type option for MotionControllerMotion
    • Motion Packs will display a warning message in the inspector if the corresponding Mixamo animation files are not present.
    • new Select Motion window that allows filtering by Category or Motion Pack; can also filter out "obsolete" motions (such as the older WalkRunPivot, etc that are still present for backwards compatibility)
      New Motion Select Window.PNG
    As well as some other fixes for issues that have come up recently. No ETA yet; just want to let everyone know that there are updates coming. :)

    I'm also working on some new setup tools to streamline the process of configuring the ootii suite of assets (for example, to configure the input settings for all ootii assets present in the project).
     
  47. N-Orbit_Studios

    N-Orbit_Studios

    Joined:
    Nov 21, 2016
    Posts:
    50
    Hello everyone, first I would like to say that I love the motion controller, and the camera controller, Awesome work.

    I have been using the these 2 assets for a while in my project with no issues , then today I added the Archery Motion pack and received this error. Can someone teach me how to fix this, thanks.

    Assets/ootii/Assets/MotionControllerPacks/Archery/Code/Actors/Motions/Bow_Dodge.cs(15,6): error CS0246: The type or namespace name `ObsoleteMotion' could not be found. Are you missing an assembly reference?
     
  48. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,557
    @TeagansDad Speaking of issues, I've been using on an AOT project and there are still various things that don't work and I've had to code workarounds. For example all these functions don't work without AOT warnings and/or crashes:

    mInventorySource.SetItemPropertyValue<int>(lItemID, "Quantity", lQuantity);
    int lQuantity = Mathf.Max(mInventorySource.GetItemPropertyValue<int>(lItemID, "Quantity") + rChange, 0);

    lRemainingHealth = AttributeSource.GetAttributeValue<float>(HealthID) - ((DamageMessage)rMessage).Damage;
    AttributeSource.SetAttributeValue(HealthID, lRemainingHealth);

    For the Get/SetAttributeValue, I had to go in and change to something like:

    BasicAttributes lAttributes = mActorCore.GetComponent<BasicAttributes>();
    if (lAttributes != null)
    {
    BasicAttributeFloat lHealth = lAttributes.GetAttribute(HealthID) as BasicAttributeFloat;
    lRemainingHealth = lHealth.Value - ((DamageMessage)mMessage).Damage;
    lHealth.Value = lRemainingHealth;
    }

    And for the Get/SetItemPropertyValue, I had to make 3 separate functions, one each for string, GameObject, and int.
     
  49. Andysco

    Andysco

    Joined:
    Jul 10, 2019
    Posts:
    2
    Hi, it works well by adjusting the InputMagnitude values. Thank you!
     
    TeagansDad likes this.
  50. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    780
    Glad I could help!