Search Unity

Bone Controller [RELEASED]

Discussion in 'Assets and Asset Store' started by Tryz, Feb 16, 2015.

  1. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Yeah, the cost is about the same. I do some additional tests to make sure we're not hitting triggers, but I haven't seen a performance impact.

    I'm actually really happy with the raycast version. However every thing is going a lot slow than I hoped. Not because of the code, but some personal things and some critical client work that jumped in. Between those and support, I just haven't gotten back to it in a couple of days. I plan to soon.

    Yeah, I think that could help. The swing I'm doing now felt pretty good to me, but there's always room for improvement. When I get the chance, I'll see if I can propagate some twist as well as the swing.
     
  2. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Tryz If I have an animated character attacking the player and he is shot in the head or arm using you hit reaction does the IK take over all the animation or would it just effect the head or arm and allow the rest of the body to carry on being animated with mecanim?
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey Griffo,

    The only parts of the body that are affected are those that are hit (and the bones the impact spreads to). All the other bones will keep moving with the animation. Those that are affected will blend with the current animation and the impact direction.
     
  4. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Tryz OK, thanks for the reply ..
     
  5. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Tryz Sorry to be a pain but is there any chance you could make a video of the character with a attacking animation then hit him in the head or arm please?
     
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    No problem. Give me a couple of days max, but I'll get it up.
     
    Last edited: Mar 23, 2015
  7. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Thanks ..
     
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    @Griffo, here's the video you asked for. I got to it quicker than I thought. :D

    In some cases, the impact is hard to see, but it's there. I'm also not doing anything that interrupts the animation on impact. That's something you'll probably want to do.



    There's a fair amount of properties. So, you can play with the spread, impact power, damping, etc.

    As we've talked about on this thread, I think it can use some twist to the bones... so that's on my list.
     
  9. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Tryz The video won't play .. :(
     
  10. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Try pressing the little gear icon and change the quality setting - it played fine for me when I switched to 720p.
     
    Tryz likes this.
  11. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    elbows Cheers, worked when I chose 480 ..
     
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    That's weird... I made it 720p and like I did all my others.

    If it doesn't show you what you're looking for, let me know. :)
     
  13. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Tryz I maybe looking for too much, maybe what I'm looking for isn't practical.

    I see the slight hit reaction in your video and I thank you for making it, I suppose I expected the arm to swing back when hit, mixing with the animation and again the leg, head to swing back when hit, maybe the way to go is have an animation for each part of the body hit, torso, head, left arm, right arm, left leg, right leg and call the one depending where they are hit?

    Or is it possible to get the body part to move more natural ?

    Thanks.
     
  14. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Tryz What if you just set the isKinematic value of the rigid body hit and say 1 or 2 children to false, so they will act with the environment for a set time then lerp them back to the animation state and reset the isKinematic value back to true, would that work?

    Just an idea ..
     
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    @Griffo The power of the hit reaction can be set by the the ray that is shot or globally inside the motor. So, you can definitely increase the result. However, it could get increased to the point where it really looks odd. I tried to find a balance for the video.

    In the web demo, I know he's in an idle animation, but it's easier to see the arms and legs swing back. With any animation, the impact and animation blend (based on the property you set) and you can totally ignore the animation like what you described.

    Maybe this will help...these are the steps:
    1. Hit is detected
    2. Deflection direction is determined
    3. The power is determined for the hit bone
    4. Other effected bones are determined

    Before impact duration (each frame)...
    5. The current animation is grabbed
    6. The impact result is added to the animation (based on weight) over a small amount of time

    After the impact duration (each frame)...
    5. The current animation is grabbed
    6. The impact result is then removed (based on weight) over a small amount of time

    You can set properties like:
    1. Power of the impact
    2. Bone spread up the chain
    3. Bone spread down the chain
    4. Dampening for the spread
    5. The time it takes for the full impact
    6. The time it takes to recover from the impact
    7. Curve that says how the impact recovers
    8. Weight of the IK vs. the current animation

    I do want to add some twist and I think that will help it look better, but I think setting the properties how you want will help too.

    Your comments are great as they help me understand what things I can improve while in beta! This motor seem to be an important one for people... honestly, I didn't expect that. This is why beta is good. :)
     
  16. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Tryz Thanks for the detailed explanation, think you may have a another customer soon :)
     
    Tryz likes this.
  17. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    After looking over the last few post, would it be better just to trigger a semi ragdoll, also if your in a beat up game the more damage that's inflicted would increase the ragdoll and make the animations more sloppy...


    Or is that whats going on?
     
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    In this motor, I'm trying to find a happy middle ground between animation and physics (ragdoll). So, it's sort of a semi-ragdoll.

    What I mean is that I'm blending the two to try to come up with something realistic or semi-realistic. Typically with a ragdoll, there's no internal muscles/motors keeping the body parts from flopping down due to gravity. That's why you sometimes see characters fall into these giant heaps. In the case of a real impact, you'd still have your muscles trying to resist the impact and take control. For this motor, I'm considering the results of the muscles to be the current animation.

    So, what I'm doing is allowing physics to cause a reaction, but the current animation frame to be the muscles or elastic that pulls the reaction back. If I go too far with the ragdoll, there wouldn't be anything that holds the character up and it would be a floppy mess.

    I hope that makes sense. This is a great conversation and I'm definitely open to suggestions!

    Just another thought... every motor I finally release with may not be a perfect fit for all situations. That's why I think having a system where people can create other motors is still a good idea. :rolleyes:
     
  19. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    Hi Tryz,

    In the documentation, the link to the PDF about bone motor creation is missing. I'd really love to read that document!

    By the way, I really love this framework you're developing for top notch character control between your various assets. Smart. Really smart. The more you make, the more I buy. ;)
     
    Tryz likes this.
  20. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey Dbone,

    I'm actually working on the document now. To be honest, I stalled a little to see if there were any major issues that would change things. Fortunately, all the reviews and personal emails have been very positive.

    So, I'll get that finished up by Monday.

    Thanks for the comments too. It helps confirm I'm moving in the right direction. :)
     
  21. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Motor Builder documentation time! Yay! wait...what...?! That isn't as exciting as it sounds? ;)

    Well, at least @Dbone is excited...

    This is the first draft of the Motor Builder's Guide. Creating these types of guides are always a little tough because I don't know the skill of the readers and I know the code too well.

    So, constructive criticism would be much appreciated. The goal is documentation that is helpful for creating new motors and not too dry.
     
  22. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    I am excited! I just got a chance to play around with Bone Controller last night. What a breeze to work with!

    A few questions though (surprise, surprise). You might not be able to help though as it's an integration thing with another asset:
    I've been using NodeCanvas for many things lately with a lot of success but I'm having trouble getting it to speak with Bone Controller. Through NodeCanvas I can create variables that are attached to a game object and then bind those variables to any other variable present on the game object as long as they are the same type (a float can only bind to a float etc.) Using this method I can conditionally control other scripts at runtime with Behaviour trees by controlling the variable I made and having it update the other script. The problem I'm having is that it appears like the variables in a bone motor are not actually attached to the game object so I can't bind to them. Specifically I am trying to control the right hand slider/float variable on the finger pose motor loaded in to the BoneControllerSkeleton.
    So I guess maybe I'm asking:
    - Where do the editable variables for a bone motor actually live in the hierarchy? Or do they? I know the BoneControllerSkeleton does not actually contain the code for any bone motors so how does it work? (feel free to chuckle knowingly to yourself here)
    - I'm presuming you have no experience with NodeCanvas since you're an all around superstar and don't require a coding "crutch" which is mostly how I use it, so how would YOU manipulate a bone motor's public variables through a separate script?

    I am among the confused but happy. If you can help I would bestow upon you appreciation, and gratitude. ...Ok fine... maybe a little reverence, you drive a hard bargain.

    Dbone
     
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey @Dbone

    Great question! I like Node Canvas a lot. It's been a while since I've used it, but I should be able to help.

    With the Motion Controller, I found creating my own tasks and conditions worked out really well. So, I created conditions like "Is Motion Active" and "Is Motion Just Finished". Then, I created tasks like "Activate Motion" and "Move To". Within these conditions and tasks, I was able to store a reference to the Motion Controller and the relevant motions. Then, I called on them as needed.

    So, I'm thinking we'd do the same thing with the Bone Controller. Mind you, I haven't actually done this yet, but I'd do something like this:

    Create a task called "Process Finger Pose Motor" or something. Inside of this task, it would grab a reference to the Bone Controller and store a reference to the FingerPoseMotor using something like <Bone Controller Instance>.GetMotor<FingerPoseMotor>().

    Now that you've got the motor you want, you can set <Finger Pose Motor Instance>.LeftCurl = 1. This would make the left hand clench into a fist.

    With that working, you could have the task hold a float that you set. The value would be from 0 to 1 and this is what you'd actually set "LeftCurl" to. With that, you could do all sorts of things like slowly move your float from 0 to 1 over time and watch the hand curl slowly. You could also extend this to control fingers individually.

    So, the task you create would allow you to set the floats. Then, you'd use these floats to set the Finger Pose Motor values.

    I found creating tasks super easy in Node Canvas. I think that covers all your questions. Don't hesitate to keep asking. :)
     
    Last edited: Apr 6, 2015
  24. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    Ok, that all makes sense to me. Make a custom NodeCanvas task that grabs the bone motor and then expose the variable I want to play with. I never successfully made a task before so I'm a bit daunted being new to code. I guess I'll need to dig through the NC docs to try and make sense of it.
    I have to say that it's too bad (and confusing to me) that NC cannot directly see the bone motors parameters. After all it can see any other public field on an attached script. Why is that? If it could see those motor parameters there would be no need to make a new task.

    Of course you realize that trying to code a task opens up a whole host of other questions for me...

    - How would I reference specific instances of bone motors. How are they differentiated?
    - Is there an API reference for Bone Controller? (that seemed like the right thing to ask, but in all honesty I have no idea if an API reference is what I need, is that where I can find out things like GetMotor.Leftcurl etc.?

    Mild anxiety setting in...
     
    Last edited: Apr 7, 2015
  25. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Once I got into making tasks, it was really easy and opened a whole new set of capabilities. I was able to take complex actions and put them into one task. It's definitely worth looking into...regardless of the BC.

    NC may be able to get at the motors. I just jumped onto the approach that clicked with me.

    The motors are simply held in a public List<BoneControllerMotor> variable on the skeleton. So, if it can go through lists that's a good first step. I'm not sure if it would be able to grab the true "type" of the motor since BoneControllerMotor is a base class and each of the motors (Pose Motor, Limb Reach Motor, etc) inherit from it. That's something that would have to be tested. If it can, you're golden.

    Each motor can have a specific name. So you could ask the skeleton for the motor by that. If you know you only have one motor of a specific type, you can ask for it that way too.

    That is a fair question. I didn't export all the documentation because I figured it was in the class/object browser of MonoDevelop and Visual Studio.



    I haven't done it before, but I could try and extract all the information and turn it into webpages. I figured since it was in MonoDevelop and Visual Studio, we'd be good. If people want it extracted, I can try that.

    If there are specific things that would help to be in the documentation, I'm happy to add it. Documentation is always a challenge for me. I want to add enough to be helpful, but not so much that it's overwhelming or boring.

    As for questions, keep asking. It helps me to know what I have to clarify and provide. I'm also happy to help you with the tasks (if you want to go down that route). :)
     
    Last edited: Apr 7, 2015
  26. Dbone

    Dbone

    Joined:
    Mar 10, 2014
    Posts:
    56
    I would love some help with the tasks. It does seem like it should be a simple enough one to make, but my C# skillz are... well... nobody would actually refer to them as skillz yet. VBA is the only language I currently have any traction with. As you can see I'm pretty unfamiliar with MonoDevelop even so thank you for pointing me towards the Classes list where I can find the API info. Things are laid out and commented well so I can't imagine needing a dedicated document.

    I think the handiest thing to make would be a generic task that could take input (for the bone motor name), and take input (for a variable name). Then set the variable according to a Blackboard value, probably updating every frame the task is active. If such a thing is possible then I could use that task to expose any variable on any motor only needing to dig into Monodevelop to check the coded name for the variable I want and double check the type.

    This is what I came up with after a truly embarrassing amount of time...

    using UnityEngine;
    using NodeCanvas.Framework;
    using com.ootii.Base;
    using com.ootii.Data.Serializers;
    using com.ootii.Geometry;
    using com.ootii.Helpers;
    using com.ootii.Utilities;
    using com.ootii.Utilities.Debug;


    public class GetBoneMotor : ActionTask{

    public string bcName;
    public string motorName;
    public string motorVar;
    public BBParameter float varVal;

    protected override void OnUpdate(){

    bcName.GetMotor motorName()

    motorName.motorVar = varVal;

    EndAction(true);
    }
    }


    Help!!??
     
  27. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    A good start, but we need to do some work. ;)

    We all start somewhere. I think it's awesome that you're not afraid to try! The key to anything is simply not to give up.

    I was looking for some old code for someone just yesterday and found this... it's my "ActivateMotion" for the Motion Controller + Node Canvas.

    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using UnityEngine;
    4. using com.ootii.AI.Controllers;
    5. using com.ootii.Utilities.Debug;
    6. using NodeCanvas;
    7. using NodeCanvas.Variables;
    8.  
    9. namespace com.ootii.External.NodeCanvas
    10. {
    11.     /// <summary>
    12.     /// Behavior Tree action used to start a specific motion
    13.     /// </summary>
    14.     [Name("Activate Motion")]
    15.     [Category("ootii/Motion Controller")]
    16.     [AgentType(typeof(MotionController))]
    17.     public class ActivateMotion : BaseAction
    18.     {
    19.         /// <summary>
    20.         /// Attribute name we're going to test
    21.         /// </summary>
    22.         public string MotionName = "";
    23.  
    24.         /// <summary>
    25.         /// Attribute name we're going to test
    26.         /// </summary>
    27.         public string MotionType = "";
    28.  
    29.         /// <summary>
    30.         /// Motion Layer the motion is tied to
    31.         /// </summary>
    32.         public int LayerIndex = 0;
    33.  
    34.         /// <summary>
    35.         /// Determines if the action waits until the motion
    36.         /// completes before flagging success
    37.         /// </summary>
    38.         public bool WaitForCompletion = true;
    39.  
    40.         /// <summary>
    41.         /// Motion to be activated
    42.         /// </summary>
    43.         private MotionControllerMotion mMotion;
    44.  
    45.         /// <summary>
    46.         /// Type of motion we're dealing with
    47.         /// </summary>
    48.         private Type mType;
    49.  
    50.         /// <summary>
    51.         /// Tracks if our motion has been activated yet
    52.         /// </summary>
    53.         private bool mIsActive = false;
    54.  
    55.         /// <summary>
    56.         /// Called once a new agent is set
    57.         /// </summary>
    58.         /// <returns></returns>
    59.         protected override string OnInit()
    60.         {
    61.             base.OnInit();
    62.  
    63.             mType = Type.GetType(MotionType);
    64.  
    65.             if (mMotion == null)
    66.             {
    67.                 MotionController lMotionController = agent as MotionController;
    68.                 if (lMotionController != null)
    69.                 {
    70.                     // Get the motion by name
    71.                     if (MotionName.Length > 0)
    72.                     {
    73.                         mMotion = lMotionController.GetMotion(LayerIndex, MotionName);
    74.                     }
    75.                     // Get the motion by type
    76.                     else if (MotionType.Length > 0)
    77.                     {
    78.                         if (mType != null)
    79.                         {
    80.                             mMotion = lMotionController.GetMotion(LayerIndex, mType);
    81.                         }
    82.                     }
    83.                 }
    84.  
    85.                 // If we still don't have a motion, return an error
    86.                 if (mMotion == null)
    87.                 {
    88.                     return "Motion not found";
    89.                 }
    90.             }
    91.  
    92.             return null;
    93.         }
    94.  
    95.         /// <summary>
    96.         /// This is called once on every execution of the Action. If the Action doesn’t
    97.         /// need time to complete, just call EndAction(bool) here to end it.
    98.         /// </summary>
    99.         protected override void OnExecute()
    100.         {
    101.             if (mMotion != null)
    102.             {
    103.                 mIsActive = mMotion.IsActive;
    104.                 if (!mIsActive && !mMotion.QueueActivation)
    105.                 {
    106.                     MotionController lMotionController = agent as MotionController;
    107.                     if (lMotionController != null)
    108.                     {
    109.                         mIsActive = false;
    110.                         lMotionController.ActivateMotion(mMotion);
    111.                     }
    112.                 }
    113.  
    114.                 if (!WaitForCompletion) { EndAction(true); }
    115.             }
    116.             else
    117.             {
    118.                 EndAction(false);
    119.             }
    120.         }
    121.  
    122.         /// <summary>
    123.         /// This is called every frame after OnExecute and only if the Action did not finish
    124.         /// OnExecute (meaning EndAction not called).
    125.         /// </summary>
    126.         protected override void OnUpdate()
    127.         {
    128.             base.OnUpdate();
    129.  
    130.             // If the motion is done, flag the action as done
    131.             if (mMotion == null)
    132.             {
    133.                 EndAction(false);
    134.             }
    135.             // If we're not waiting, call it done
    136.             else if (!WaitForCompletion)
    137.             {
    138.                 EndAction(true);
    139.             }
    140.             // If we are waiting, we have to activate before we can
    141.             // ever be done
    142.             else if (WaitForCompletion)
    143.             {
    144.                 if (!mIsActive && mMotion.IsActive)
    145.                 {
    146.                     mIsActive = true;
    147.                 }
    148.                 else if (mIsActive && !mMotion.IsActive)
    149.                 {
    150.                     mIsActive = false;
    151.                     EndAction(true);
    152.                 }
    153.             }
    154.         }
    155.  
    156.         /// <summary>
    157.         /// Specify the information shown when the condition is assigned on a node.
    158.         /// </summary>
    159.         protected override string info
    160.         {
    161.             get
    162.             {
    163.                 string lMotion = MotionName;
    164.  
    165.                 if (mMotion != null) { lMotion = mMotion.Name; }
    166.                 else if (lMotion.Length == 0 && mType != null) { lMotion = mType.Name; }
    167.                 else if (lMotion.Length == 0 && MotionType.Length > 0)
    168.                 {
    169.                     mType = Type.GetType(MotionType);
    170.                     if (mType != null) { lMotion = mType.Name; }
    171.                 }
    172.  
    173.                 return string.Format("Activate {0}", lMotion);
    174.             }
    175.         }
    176.     }
    177. }
    178.  
    It's not exactly what we want, but I think it's close. Take a look at this and see if it makes sense.

    As you scan the code, replace these in your mind:
    MotionController = BoneControllerSkeleton
    MotonControllerMotion = BoneControllerMotor
    Motion = Motor

    How about we take this to email too. This way we can email back and forth and it will be easier for me to explain what's going on. Shoot me an email to tim@ootii.com and we'll get this working.
     
    Last edited: Apr 7, 2015
  28. mkgm

    mkgm

    Joined:
    Apr 10, 2015
    Posts:
    134
    1. Hello @Tryz,
    2. great asset.
    3. Do you have plans to make some performance tune for mobile?
    4. That would be awesome.
     
  29. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hi @mkgm ,
    I have been doing some clean-up. Part of that is making sure I'm not allocating too much for the GC. I think that will help all platforms. I'm not really trying to performance tune a specific platform as much as general improvements.
     
  30. DarkMath

    DarkMath

    Joined:
    Dec 9, 2009
    Posts:
    25
    I'm unable to select a bone in the scene view per the instruction in the BoneControllerSkeleton "IKMotors" rollout. Is anyone having that problem? I'm using Unity5.

    Update: I just answered my own question. I was trying to select a bone in the scene without the "Pan Tool" (the one with the Hand) selected.

    Once I did that I was able to select a bone. I'm all set now.
     
    Last edited: May 26, 2015
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey @DarkMath ,

    I just got home and replied to the message. :)

    I'll bet you're hitting what I talk about on page 13 under "Bone Selection"
    http://www.ootii.com/Unity/BoneController/BCGuide.pdf

    Because Unity automatically selects the mesh when you click on the skinned-meshed character, you have to first choose the "pan" tool in the Unity tool selector. Then, you can select the bone I create and press "+".

    Give that a try and let me know if it solves it for you.

    I'm using it in Unity 5. So, you should be good.
     
  32. DarkMath

    DarkMath

    Joined:
    Dec 9, 2009
    Posts:
    25
    I've got another problem now. I've added two PoseMotors: a Pose Motor and a Finger Pose Motor. The problem is was I added the second motor (for the Finger Motor) I can't select the original Pose Motor. Any ideas?

    Answered my own question again........I had to click on the black dot to select the row. Maybe next version you could select anywhere in the row?
     
    Last edited: May 26, 2015
  33. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Yes! One of the things I'm playing with is Unity's new list control that allows you to re-order items in an inspector list. It's working good for the Motion Controller lists and I plan on bringing it to the Bone Controller too.
     
    hopeful likes this.
  34. DarkMath

    DarkMath

    Joined:
    Dec 9, 2009
    Posts:
    25
    Another question: I've been playing around building poses. Things are working great. This is what's missing from FinalIK, specifically making the posing of a character easier. That said is it possible to pose a character with one PoseMoter and then added another PoseMoter that copied the pose from the previous PoseMotor?

    You can see where this is going: use Bone Controller as a full on Character "editor". Maybe Motion Controller has this already? I'm not sure what the difference is between Bone and Motion Controllers.
     
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    hahaha... you're connecting the dots.

    My thinking all along was that I would eventually extend the Bone Controller into something similar to Autodesk's Motion Builder. I think being able to link poses and create procedural animations would be awesome. Unfortunately, the last couple of months have just been chaos for me (family, work, my game, Unity 5 migrations, etc.) When it hits... it hits all at once.

    But, you're thinking along the right lines. :D

    As for the difference between the MC and BC... I didn't originally have all this in my head a year ago. Instead, it has evolved as I've used these for my own game and based on feedback. Here's the road I'm going down:

    Actor Controller (currently part of the Motion Controller):
    Base character controller that manages the overall character position, velocity, gravity, body collider, etc. It's a replacement for Unity's Character Controller. Today it isn't a separate thing, but merged into the Motion Controller.

    In the video I showed, you can use this AC to create things like spiders that walk on the walks and ceilings. This is something I've wanted in a character controller for a while.

    Motion Controller
    Today, it includes the "character controller" part. Meaning it manages the character position, velocity, gravity, body collider, etc. However, V2 will have those pieces split out (into the Actor Controller).

    In addition to this, the Motion Controller manages the animations that are associated with the character and when those animations trigger.

    Take the physics based jump vs a raw animated jump... If you just have a regular jump animation, what happens when an object slides under you while you jump? The full jump animation wants to continue and it doesn't look like you land as you really would.

    Instead, if we break the jump into pieces and then manage when those pieces occur based on distance from the ground, vertical velocity, and other things, the whole thing can be more realistic and reactive. So, the Motion Controller provides a way to blend animations and code to have complete control over how a character reacts. It does this in a modular way using "motions" you can share between characters.

    Bone Controller
    This provides a way of accessing and manipulating the bones using IK/FK so we can tweak the resulting animations of the MC. It's not good enough to just have a walk animation. Instead, we want to tweak that animation in real time so that our characters reacts to environmental changes...during game play.

    The other thing I hinted at was procedural animations. The idea that we could take one base "attack" animation and change it (at run-time) to become a "sword swing" or "hammer swing" or "pole-arm swing" animation becomes exciting. Especially for us programmers who aren't great animators!


    Which leads me to an admission to everyone...

    So, the reason that the Bone Controller hasn't come out of beta yet is that between all the chaos, I'm creating this entire framework in Unity5... the AC + MC2 + and final BC. Feedback on the BC is great, but I've taken a step back and rethought about everything as an integrated (but modular) solution. I'm using it now (in an alpha form) and having this complete solution working out REALLY well... it's just taking a while.

    Whew... I hope that helps. :D
     
  36. DarkMath

    DarkMath

    Joined:
    Dec 9, 2009
    Posts:
    25
    Is there a way to copy a PoseMotor to a new PoseMotor so I don't have to rebuild the previous animation and then tweak that?

    Maybe you answered this above when you talking about mimicking 3dStudio's motion builder.
     
  37. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Today there isn't. I think that's a good feature, but it will take me another week or two to get to it.
     
  38. DarkMath

    DarkMath

    Joined:
    Dec 9, 2009
    Posts:
    25
    How about calling one pose after another? Say I have an idle animation and I want to create 2 poses that shoot a basketball. The first pose would be the position of the arms right before the shot begins. And the second pose would be right after the ball is released.

    Idle -> Pose1 -> Pose2 -> Idle.
     
  39. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Right. That's a basic version of procedural animations. Basically we'd fill in all the frames based on some curve between the two poses you mentioned. That's where I'd like to go, but it doesn't do that right now.

    As a "mid" plan (meaning before the full plan I detailed), I could probably create a motor that allows you to have multiple poses and does a simple blend using a straight interpolation. It basically would result in a short animation like what we're talking about. I need to think about it, more.
     
  40. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,682
    There is a plugin that does some of the things a person might be looking for in the area of poses / animation: Skele. It is well-supported. I don't know if it is a helpful adjunct if you own BC or not, but it came to mind so I mention it in the hope it might help someone. :)
     
    Tryz likes this.
  41. abatcat

    abatcat

    Joined:
    Feb 8, 2015
    Posts:
    70
    How well would this work on mobile platforms like android and ios?
     
  42. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I have run it on the Android (Galaxy S4 + Note 4), but I don't own any iOS devices. I haven't done anything that would preclude it from working, but I also haven't done any mobile specific performance tuning. I do plan on doing it in the future, but it's further down on my list. ;)
     
  43. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    I bought this yesterday and it is looking good, but how do I do the following?

    I have an animation of holding a pistol with two hands

    The hand position and fingers are not right and I want to use BC to put them right.

    But I can only see him in the pistol state when the animation is running and I cannot change the bones when the editor is in play mode

    So when I stop he is back to T-Pose.

    So how am I supposed to edit the finger positions?

    So in other words I need to get to the part of the animation where he is holding the pistol and the use the bone motors to change the pose.

    Thanks from Chris.
     
  44. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey Chris,

    So, that's an interesting idea/challenge. You want to create a pose based on an animation. But, we can't play the animation in the editor... Currently, I don't have a way of reading a Unity animation file and playing it back.

    In trying to think about some solutions that would help you now, I think there are three options...

    1. Mimic the animation pose
    Add a "Pose Motor" to your character and enable it to "Run In Editor". Then, pose your character into the "holding a pistol with two hands" stance that matches the animation frame. I realize this won't perfectly match the animation, but it should get you close enough that you could then use the "Finger Pose Motor" (and possibly another "Pose Motor") to get the final setup you're looking for.

    2. Create a run-time editor
    This sounds scarier than it really is... You can change the bones while in play mode. In fact, I do that in the "Finger Pose Motor" scene using Unity GUI elements (it's the scene with the human and goblin hands in view). I already have the code and GUI for the right hand. All you'd need to do is copy that for the left hand as well. Then, you could play an animation to the frame you care about using any standard Unity approach. Once there, you'd modify the value in real-time.

    The only gotcha is that the values wouldn't "stick". Once you leave play mode, the values will drop back as Unity normally does. You'd have to write-down/remember the settings and apply them when not in play. Doable, but not very convenient.

    3. Find an in-editor animation solution
    To be honest, I'm not sure if one exists. But, if there is a solution that allows you to play animation files in the editor, you should be able to use that to set to the base frame you want to pose off of and then make the "Finger Pose Motor" and "Pose Motor" changes you want.


    #1 seems like the best approach and shouldn't be that hard.


    Creating an in-editor animation player seems like no small feat. It would be interesting, but I don't see it happening in the near future. Let me know if any of the above solutions work for you. Also, feel free to email me at tim @ootii.com and I'll help how I can.
     
  45. ChrisSch

    ChrisSch

    Joined:
    Feb 15, 2013
    Posts:
    763
    Hi ZJP! I think you're confusing a character controller script with an IK controller (his bone controller). :)
    His bone controller is meant to point bones, such as hands and feet towards a point (like the ground, or an object). Correct me if I'm wrong, but what I think you want is a character controller script, which points the -Y of the character towards the center of your "planet", and then either moves or uses force through script to push it towards the center while you walk, thus simulating spherical gravity in that way, or another. But an IK controller can't do that for you. You have to rotate the character yourself through script, and then the IK controller will match the legs to the surface, or whatever you specified. In most cases the IK controller is used to make the animations look more realistic.

    PS. Nice asset! Just commenting here to watch, and bump your thread. :D

    EDIT: Realized that's an old post I replied to. I'm sleepy. Oh well. :p
     
    Tryz likes this.
  46. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Hey @Tryz

    This asset has been on my wishlist for a while and I finally got to a point where I was ready to pick it up and start playing around with some nice IK on my characters and it got me thinking about a few other "features" I require for my project, and perhaps BoneController can help me out, or maybe it's a bit out of scope for this package. I need to do a bit more research but here's what I'm wondering.

    1) I have two skinned meshes: a character and a cape. I figure I can mount the cape (with mount points ;)) and I'd like to simulate the cape one way or another. (Similar to your bone joint drag motor, is there a ragdoll motor?). Looking at your demo this shouldn't be an issue and it should start moving dynamically like your dino tail, but what about collisions especially against the character? Will my cape simply fall through the character? If so is there any way to rectify this behaviour?

    I read that you're using "pseudo-colliders" to speed things up a bit but I'm not sure how well these work against slightly more complex interactions

    2) Extending this a bit more, could this work for something like jiggle bones? I assume it's the same idea, but just wondering!

    3) Ragdolling. I noticed this was mentioned before, but would it be too difficult to get up and running to drop my character into a ragdoll?

    Thanks!
     
  47. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,682
    @DMeville - You might consider making the cape out of the new cloth. I understand the new cloth will flow and respect colliders that are placed on your character's body.
     
  48. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @hopeful Hey thanks for that! I tried out Unity's old cloth but I wasn't aware they made improvements with Unity 5 (how did I miss this?!?) I just played around with it a bit and colour me impressed. This might just be the method I'll use regarding my first question. Thanks! :)
     
    hopeful likes this.
  49. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey all! I'm back... the family and I were on a whirl-wind tour of Europe. :D

    I tried to respond as best I could and I'm catching up on questions I didn't get to. If there is something I missed, please hit me up again.

    @hopeful , Thanks for always being so helpful!! ;)


    Hey @DMeville ,

    Love the video. If I'm understanding correctly, BC already supports "jiggle bones".

    The Bone Chain Drag motor is what you're looking for. For the mouse, the ears, tail, and even guitar-mount would be bones that are used by Bone Chain Drag motors. It's just a matter of balancing the Gravity, Gravity Impact, and Stiffness of the bone chains. That will give you the bounce you see in the video.

    If you want to use true colliders instead of my simple ones, you have two main options:
    1. You can use the "Force True Colliders" option in the skeleton setup. This will change the style of colliders for all bones.
    2. You can add Unity colliders directly to each bone transform just like you would in any Unity project.

    The biggest challenge I found is that bones with true colliders can cause odd interactions with each other and the environment. Take a walk cycle. The colliders on the thigh bones, shin bones, and foot bones can collide with each other and ruin the walk cycle. There are ways to prevent one collider from colliding with another, but it gets complex with something like the mouse since you want the tail to collide with the legs, but not the shin with the thigh. The "psuedo" colliders tried to simplify that by allowing collisions on the "down" vector only.

    I started to look into this as well. There's a couple of things I'm "pretty close" to: rag-dolls, blending, animation creation, dynamic animations, etc. I just had to pick my battles. ;)

    One of the things I was doing before vacation was integrating new versions of my assets into my game. The goal being three-fold:
    1. Move my game forward... which really want to do.
    2. Ensure v2 of the assets (AC, AC&R, MC, BC, etc) take advantage of all U5 has to offer.
    3. Ensure all assets work as a single integrated 'Unity Character Solution'.

    As I do that, I'm adding features that I need and I get requests for. I'm not there with ragdolls yet, but I know I will be. I've upped the priority for ragdolls, but no date to commit to yet.

    Hope that helps.
     
    hopeful and DMeville like this.
  50. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @Tryz Cool! Great to hear about the jiggle bones!

    I'm in no rush, but if I can use this asset for ragdolling in the future (in addition to other IK stuff I wanna do) I'd rather use this asset than continue searching for another one. Any progress you have on this you should keep us posted :D

    Keep up the awesome work!!
     
    Tryz likes this.