Search Unity

Motion Controller

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

  1. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    I changed a couple keys around(actually copied existing code and just added keys by looking in the inputmanager.cs).

    I lost my animators motions on the last update and learned my lesson.lol

    1. Just manually move your Humaniod controller to a backup folder(I also moved my InputManager.asset in project settings so I wouldn't have to redo my custom inputs I added.).

    2. Import the updated Motion Controller package, then right click the folder you want to import your old Humanoid.controller to and it will return with all your previous settings, as Humanoid_1 as it's new name.

    Hope this helps.

    Edit:

    Just found that this method requires I go back to the new animator and reset all the anystate transistions to what they are on the new humanoid.asset.

    I'll see if I can avoid this by exporting the Old Humanoid.controller as a unity pkg and reiport if it will save it's setting that way.

    I'll post back with the results.

    Edit2:

    That didn't work either, but you can always click through the states on the new Humanoid.controller and just click on the saved one to see what anim is where, and reallocate them. you only lose the anystate transitions so changes added to the old transitions will be there to look at as well.

    Tim is aware and working on a solution. So we'll see what he comes up with.
     
    Last edited: Apr 18, 2014
  2. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Thanks for jumping in Kurotatsu!

    Unfortunately, the animator is still the biggest sticking point when it comes to updating/sharing motions. Keep reading...

    Hey 3, Glad you got into motion building! :)

    As Kurotatsu said, check out the InputManager.cs. That's where you'll find the answers to a lot of your questions. You can change the camera so you don't have to hold down the right mouse button; you just need to comment out 2 lines (85 and 110).

    In the InputManager.cs, you can make changes to fit your game play. I've tried to divorce all the raw button presses from the actions themselves.

    I'm not quite following. Shoot me an email (tim@ootii.com) and help me understand. I should be able to help.

    Fair question and what Kurotatsu was was talking about.

    The challenge is that a character can only have one Animator. So, all sub-state machines, animations, and transitions have to belong to the same file. I've tried dynamically creating these things, but that quickly became a nightmare.

    Now that the Motion Controller has been running for about 5 weeks, I don't anticipate me changing the raw Humanoid Animator any more. However...


    Protecting Your Custom Animator
    If you've customized the Humanoid Animator that I provide, you want to protect it from my updates. While I don't plan on updating the actual Animator any more, these steps will help make sure nothing accidentally gets overwritten.

    1. Go into the Windows Explorer folder containing your current Animator. If you're using the one I added to the project, it's under 'Assets/ootiiMotionController/Models/Animations'.

    2. Copy the 'Humanoid.controller' file to another folder. In my project, I copied it to 'Assets/ootiiMotionController/Models/Animations/Humanoid'.

    3. Go back into Unity and it will import this 'new' Animator Controller.

    Now you have two different Animators in your project. Note that it's not good enough to just rename your previous Animator as Unity has an internal ID that it uses to update files. You need to create a new copy using the steps above and Unity will import it as a new asset.

    All your sub-state machines, animations, and transitions (even the AnyState transitions) should be copied over nicely.

    4. Update your avatars to use this new Animator Controller.

    With this done, when you get Motion Controller updates the original Animator will be updated, but the one you're actually using won't be.


    Sharing/Using New Motions
    This is more of a plan as I haven't shared any new motions with you this way, but...

    As new motions are released (by me or others), the idea is that they would each come with their own Animator. Now, this animator won't really be usable, but what it will do is hold the sub-state machine that you'll copy and past into the actual Animator that you are using (i.e. the one you just copied).

    Copying sub-states across Animators works pretty well, but with one drawback; the 'AnyState' transitions in the sub-state being copied are lost. That being said, we're talking about a couple of transitions...maybe a handful at the most. It will probably take 2 minutes to re-add them.

    Note: This is one of the reasons I'm big on keeping each motion contained in its own sub-state machine. It keeps copying and rebuilding the 'AnyState' transitions as simple as possible.

    ---

    While doing it this way isn't the perfect solution, it protects your customized Animator and allows you to bring in new motions with relative ease.

    In the next week or two, I'll come up with a new motion and share it this way. This will give everyone a chance to use the workflow.

    I'll also update the documentation.


    Hope this helps,
    Tim

    Sorry for the mammoth posts :)
     
    Last edited: Apr 18, 2014
  3. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    sent ya an email
     
  4. 3

    3

    Joined:
    Sep 16, 2012
    Posts:
    387
    Hey Tim, just a random question, I noticed a new motion, "Edge Slip," What's it do?
     
  5. Tryz

    Tryz

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

    Have you ever played a game where you stop at the edge of a cliff... when you look down, one foot is on the ground and the other foot is oddly floating in mid air?

    When idle, EdgeSlip tests each foot to ensure it's on solid ground. If one foot is floating, the avatar will start to slide towards the floating foot until they slip off the edge or move.

    It's a good example of a motion that doesn't require any animations. It's worked pretty well so far. However, I haven't introduced it yet because I hadn't fully tested it out. :)
     
    Last edited: Apr 24, 2014
  6. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    I like your mecanim assets(Motion Controller and Adventure Camera Rig) and trying to implement multiplayer 3rd person shooter using them. So far so good only one issue I have now is how to make right vertical look of the character with the gun to point him to the cross-hair. I'm new to the mecanim but in legacy world I'll do something like segment rotation to override animation and bend the model.
    It should work with the mecanim as well, but is it the right way to do it? Please advice.
    $mc.jpg
    PS I guess it makes sense not only for TPS but for platformer/RPG as well.
     
    Last edited: Apr 24, 2014
  7. Tryz

    Tryz

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

    I think when you say 'segment rotation', you mean 'bone rotation'. If so, you're right.

    I'm not sure if you can do it with the free version of Unity, but with Unity Pro (or something like FinalIK), you can grab the spine bone and then rotate it along with the view. You'd have to do some math to line it up with the cross-hairs, but that shouldn't be too hard.

    In the ClimbCrouch.cs file, You'll see I started using IK in order to move the hands to the climb position. If you search for "Animator.SetIK", you'll see the following lines commented out:

    //mController.Animator.SetIKPositionWeight(AvatarIKGoal.RightHand, rWeight);
    //mController.Animator.SetIKRotationWeight(AvatarIKGoal.RightHand, 0.0f);
    //mController.Animator.SetIKPosition(AvatarIKGoal.RightHand, mRightHandTargetPosition);


    In this case, I'm forcing the hand to a specific position and rotation. The "weight" values determine how much to override the animation. You'd want to do something similar.

    I haven't actually tried it myself, but I agree that it's something that would be good. I just didn't want to limit the Motion Controller to only those people that had Unity Pro or FinalIK.

    I hope this gets you started on the right track. When I get some time, I'll poke around as well.
     
  8. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    Thanks Tryz
    I've fixed it temporary using legacy segment/bone rotation head-look script(I have Unity pro), but I'm looking forward for the right mecanim solution and hope that new motion will be really very useful for our community. Great work and support!

    Edit: bone rotation head-look script works fine with the Unity Free as well
     
    Last edited: Apr 29, 2014
  9. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    I've been hoping for this as well(which is why I haven't started working on the ranged atks.).

    While I found the walk anims for the aiming is the Walk-360SM, ya might consider another naming convention like RangedLocomotion-SM unless these movements are dependent elsewhere in the movement scrip.

    I'm waiting to see a solution to rotate the avatars upper body towards at least the general direction of the crosshairs, I usually used an empty parented to the front of my character matching the camera's rotation to fire at my crosshairs with my own system, but the camera was directly behind the player, this is a unique problem since the camera is over the shoulder.

    It'll be interesting to see where this goes.

    Edit:

    I've got badass video to put up with my character, that will blow your minds I just have to finish implementing doublejump, and rolling.
     
    Last edited: Apr 25, 2014
  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    On Monday, I'll start working on this. It's something I've been wanting to do as well and will carve out some time for it.

    It should give me a better understanding of how we can tap into IK.

    No promises on how long it will take or if it will require Unity Pro. I'll know more once I get into it.
     
  11. 3

    3

    Joined:
    Sep 16, 2012
    Posts:
    387
    EDIT: Nevermind! Fixed it! It was the stupid "Skin Width" I should read the instructions more often haha. I would make that a bit more clear in the Manual Tim, caused me a few hours of frustration,

    Hey Tim,

    I've been trying to place my own model into the game, and either I've done something wrong (Which I probably have) Or I've encountered a bug. With your default character it works fine, but with my own model (I just moved all the scripts and motion controller, everything I believe is set up properly) it works fine for a bit then freezes and I'm unable to move as the game goes on. This usually only occurs when I try to jump or climb, running doesn't seem to instigate it. I've tried it without all my own stuff (Shooting and teleporting), this error still happens. Any ideas?

    Also yeah, I did quite a bit of research and I believe IK with pro is the only solution to the aiming. (Unless you use FinalK)

     
    Last edited: Apr 26, 2014
  12. Tryz

    Tryz

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

    Great video! Not only does that help, the action itself looks great.

    Your aiming, tilting, and arm positioning looks awesome. I think that's exactly what others are looking to replicate. I'm focusing more on a bow, but hopefully I can get people close to what you've done.

    Glad you got it fixed! To be fair, on page 12 I talk about skin width and there's a big bold blue box:

    "If you encounter problems when jumping, try changing the 'Skin Width' for your unique avatar model."

    I'm not sure how to make it more clear. ;)

    That said, if you do have a suggestion for the documentation, I have no problem updating it!
     
    Last edited: Apr 26, 2014
  13. dl_studios

    dl_studios

    Joined:
    Oct 14, 2012
    Posts:
    76
    Hi Tim,

    Question: Today we've been creating triggers to apply health damage when player runs into them. However, an odd thing happens with the trigger. Usually when a collider is marked as a Trigger all objects will simply pass through the collider as if air, however the Motion Controller gets hung up on the collider until you "muscle" through it. It feels a bit odd. Why is this happening and what would be the best way to fix it?

    Thanks.
     
  14. Tryz

    Tryz

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

    One of my visions for the Motion Controller was that it would be used for NPCs as well as PCs.


    To do this, I knew I'd have to build out an AI system. Fortunately, Opsive did it for me with their Behavior Designer. It's well designed, extensible, and easy to use. Definitely check it out.

    I've created some Motion Controller specific actions that are controlling the NPCs. I plan on releasing them with the next update (or two).

    Let me know your thoughts and suggestion.
     
    Last edited: Apr 30, 2014
  15. Tryz

    Tryz

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

    I confirmed that it is the bumper I use to stop the character if he runs into a wall.

    I'll fix this for the next updated, but you can fix it by doing this:

    1. Open the MotionController.cs
    2. Search for "Raycast(lForwardBumperRay" (you'll find two of them next to each other)
    3. When the Raycast hits something, we need to test if it's a trigger

    Inside the brackets, wrap the contents with:

    if (!sRaycastHitInfo.collider.isTrigger)
    {
    ...
    }


    Feel free to email me at tim@ootii.com if you need help. I've got a couple more changes before I push the package out.

    Thanks,
    Tim
     
  16. Goldrake

    Goldrake

    Joined:
    Feb 6, 2010
    Posts:
    148
    Great Tim!
    Waiting for Behavior Designer compatibility and AI demo :)
     
  17. dl_studios

    dl_studios

    Joined:
    Oct 14, 2012
    Posts:
    76
    Thanks Tim! That fixed it!
     
  18. dl_studios

    dl_studios

    Joined:
    Oct 14, 2012
    Posts:
    76
    Oops wait, the code fixed the bumper issue, but the the motions controller's ground detection still allows the motion controller to walk on triggers. I went through the code and wrapped all logic that used raycasts for detection with if(!hit.collider.isTrigger) and that fixed most of the issues. I couldn't find where the ledge slip detection was so he still reacts to the trigger a bit, but at least he isn't able to ride on the trigger collider:).

    The current fixes work well enough until the next MotionController release.

    Thanks!
     
    Last edited: Apr 30, 2014
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    In fixing the bumper, I addressed all the other areas as well. I ended up creating a "SafeRaycast" function that's called on the Motion Controller. It actually worked out better because a lot of people were forgetting to set the "Player Layer" and removing that requirement as well.

    I'm doing some performance tests now. If all goes well, I'll submit on Friday and it should be live in a week.

    I appreciate you going in and working around the issue. If you can't wait for the update to go out, just email me and I'll send you the latest build I have.

    Thanks for your patience! :)
     
  20. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    I'm very close to implement multiplayer using TNet(it will be easy to port to photon as well). So far I have one major problem - how to pass left right movement when you control the model using mouse to turn it. In other words if I do not do transform correction, my network model reacts only on ASDW but ignores mouse.
    In motions scripts I've replaced "InputManager" calls to my script "NetworkController.cs" like:
    Code (csharp):
    1.  
    2.     public class Punch : MotionControllerMotion
    3.     {
    4.         NetworkController nc;
    5.         // Enum values for the motion
    6.         public const int PHASE_UNKNOWN = 0;
    7.         public const int PHASE_START = 500;
    8.  
    9.         /// <summary>
    10.         /// Default constructor
    11.         /// </summary>
    12.         public Punch()
    13.             : base()
    14.         {
    15.             _Priority = 10;
    16.             mIsStartable = true;
    17.             if( nc == null)
    18.             {
    19.                 foreach(GameObject go in GameObject.FindGameObjectsWithTag("Player"))
    20.                 {
    21.                     if(go.name == NetworkController.oName())
    22.                     {
    23.                         nc = go.GetComponent<NetworkController>();
    24.                     }
    25.                 }
    26.             }
    27.         }
    28. ...
    29.         public override bool TestActivate()
    30.         {
    31.             if (mController.UseInput  nc.IsJustPressed("PrimaryAttack")  nc.IsPressed("Aiming"))            {
    32.                 // Grab the state name from the first active state we find
    33.                 string lStateName = mController.GetAnimatorStateName();
    34.  
    35.                 // Ensure we're not currently climbing
    36.                 if (!lStateName.Contains("ClimbCrouch-SM"))
    37.                 {
    38.                     return true;
    39.                 }
    40.             }            
    41.  
    42.             // Get out
    43.             return false;
    44.         }
    45.  
    NetworkController.cs
    https://www.dropbox.com/s/ywm57fmrm9k9q0k/NetworkController.zip

    web player:
    http://exposedconflict.com/web/web.html

    Tim
    May be you have better idea how to implement multiplayer than passing input values
     
    Last edited: May 24, 2014
  21. Tryz

    Tryz

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

    Unfortunately, I'm not really following.

    You wrote: "how to pass left right movement when you control the model using mouse to turn it", but the script above seems to deal with 'IsJustPressed" and "IsPressed". I'm a bit lost.

    Since you're dealing with multi-player logic, are you trying to get the "other player's Motion Controller" to move and act on your computer based on their input?


    If that's the case, I'm wondering if you'd want to pack their user input into the ControllerState objects of the Motion Controller. Then pass their "PrevState" and "State" values over the network. You could then use that to control their character on your machine.

    I haven't done network code before, but this might work. Also, look at how I control NPCs. That might help too.


    Can you go into more detail about what you're trying to do and what's not working?
     
    Last edited: May 8, 2014
  22. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    Script contains not only IsPressed functions but all other input variables that you use in different scripts to get values from InputManager:
    MovementX,MovementY,ViewX,ViewY,InputFromCameraAngle,InputFromAvatarAngle
    I'm sending all these variables by network to simulate user input on remote model. I've replaced in all scripts calls to InputManager.[Variable/Function] with NetworkController.[Variable/Function].
    ControllerState struct is pretty big in terms of amount of data and some complex data types/objects(serialization of some Unity specific data types like Vector3 is another big headache). I've spent a lot of time today trying to pass ControllerState "PrevState" and "State" values over the network and issue with changing direction is resolved but I got couple of other problems like inadequacy crazy jumps(it seems that some complex motions are corrupted). Note that in "Input" version of network controller I have _UseInput = true but in "ControllerState" version false. Now I'm even more confused which way to go and how to fix the jump problem.
     
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Having a multi-player implementation is interesting. I'm not exactly sure how the network handles users input and characters. So, everything I'm going to put comes from an AI perspective. Hopefully it helps...

    I've been working with the owner of Behavior Designer to create some custom actions for controlling the Motion Controller. This would allow AI behavior trees to control character movement and motions. To do this, I've got two basic approaches:

    1. Simulate input
    2. Active motions

    Simulate Input
    The Motion Controller has a function called SimulateInput() that uses a 'Position Target' to fake user input. It works when "_UserInput == false". This basically means that some AI (or possibly network code) is actually controlling the avatar. The advantage is that no motion code needs to change.

    The motions don't care if they are being controlled by a human, by AI, or by network code. They just follow what the state variables say. And those are set in SimulateIput().

    To set the position target, you'd call:
    MotionController.PositionTarget = <some Vector3>;
    MotionController.PositionTargetSpeed = 1.0;

    Activate Motions
    In some cases (like a Jump), the AI behavior tree node is actually calling the motion explicitly. In your case, it could be because a network code bit is flipped.

    If you do this you'd simply process the network code and if you saw the 'Jump' flag, you'd call:
    MotionController.ActivateMotion(typeof(com.ootii.AI.Controllers.Jump));


    I'm not sure if this is going to help with the network code, but it's working well for the AI.
     
  24. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    I'm not able to find MotionController.PositionTargetSpeed
    And how to get value of PositionTarget from controlled model?

    Edit: I guess that I'll end up creating bool _UseNetwork and cloning ProcessInput() to NetworkInput()
    AI behavior is too different(simplified) from input controlled. NetworkInput() should be something in the middle between ProcessInput() and SimulateInput()

    Edit2: Input based script fixed(direction issue)!
    Now I have in Update():
    Code (csharp):
    1.             // Grab the direction and speed of the input from the keyboard, game controller, etc.
    2.             if (_UseInput)
    3.             {
    4.                 ProcessInput();
    5.             }
    6.             // Otherwise, use the target movement and rotation from AI to simulate movement
    7.             else if(_UseNetwork)
    8.             {
    9.                 NetworkInput();
    10.             }
    11.             else
    12.             {
    13.                 SimulateInput();
    14.             }
    Added function NetworkInput():
    Code (csharp):
    1.         private void NetworkInput()
    2.         {
    3.             if (_CameraRig == null) { return; }
    4.  
    5.             // Grab the movement, but create a bit of a dead zone
    6.             float lHInput = nc.MovementX;
    7.             float lVInput = nc.MovementY;
    8.             float lMagnitude = Mathf.Sqrt((lHInput * lHInput) + (lVInput * lVInput));
    9.  
    10.             // Add the value to our averages so we track trends.
    11.             mState.InputMagnitudeTrend.Value = lMagnitude;
    12.  
    13.             // Get out early if we can simply this
    14.             if (lVInput == 0f  lHInput == 0f)
    15.             {
    16.                 mState.InputX = 0f;
    17.                 mState.InputY = 0f;
    18.                 mState.InputForward = Vector3.zero;
    19.                 mState.InputFromAvatarAngle = 0f;
    20.                 mState.InputFromCameraAngle = 0f;
    21.                 return;
    22.             }
    23.  
    24.             // Set the forward direction of the input
    25.             mState.InputForward = new Vector3(lHInput, 0f, lVInput);
    26.  
    27.             // Direction of the avatar
    28.             Vector3 lControllerForward = transform.forward;
    29.             lControllerForward.y = 0f;
    30.             lControllerForward.Normalize();
    31.  
    32.             // Set the direction of the movement in ranges of -1 to 1
    33.             mState.InputX = lHInput;
    34.             mState.InputY = lVInput;
    35.  
    36.             // Keep this info in the camera as well. Note that this info isn't
    37.             // reliable as objects looking for it's set it will have old data
    38.             nc.InputFromCameraAngle = (mState.InputMagnitudeTrend.Value == 0f ? float.NaN : mState.InputFromCameraAngle);
    39.             nc.InputFromAvatarAngle = (mState.InputMagnitudeTrend.Value == 0f ? float.NaN : mState.InputFromAvatarAngle);
    40.         }
    In my NetworkController.cs I pass 2 additional parameters:
    mState.InputFromCameraAngle and mc.mState.InputFromAvatarAngle

    So the problem was in the following lines of ProcessInput():
    Code (csharp):
    1.             // Transform joystick from world space to camera space. Now the input is relative
    2.             // to how the camera is facing.
    3.             Vector3 lMoveDirection = rToCamera * mState.InputForward;
    4.             mState.InputFromCameraAngle = NumberHelper.GetHorizontalAngle(lCameraForward, lMoveDirection);
    5.             mState.InputFromAvatarAngle = NumberHelper.GetHorizontalAngle(lControllerForward, lMoveDirection);
    because of different value of lCameraForward Vector3 (I guess it was always 0)
     
    Last edited: May 9, 2014
  25. Tryz

    Tryz

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

    I'm not sure if the version you have has this function: MoveTowards()

    In it, I do this:

    /// <summary>
    /// Moves the avatar towards this position over time using the controller's
    /// locomotion functions.
    /// </summary>
    /// <param name="rPosition">Position the target is heading to</param>
    /// <param name="rNormalizedSpeed">Value of 0 to 1 where 1 is max speed</param>
    public void MoveTowards(Vector3 rPosition, float rNormalizedSpeed)
    {
    mPositionTarget = rPosition;
    mPositionTargetSpeed = rNormalizedSpeed;
    }

    It may be in the latest Motion Controller code I'm looking to push up. Either way, you should be able to get to the PositionTargetSpeed. That's just a property on the Motion Controller.

    I think you've got it now, but PositionTarget is the next position you want the character to move to.

    What you did with _UseNetwork and NetworkInput() makes total sense. Just remember to temper the input with mPositionTargetSpeed. In my latest version, I do this:

    // Determine the simulated input
    float lHInput = 0f;
    float lVInput = 0f;


    // Grab the movement, but create a bit of a dead zone
    if (lMovement.magnitude < 0.01f)
    {
    lHInput = 0f;
    lVInput = 0f;
    }
    else
    {
    lHInput = 0f;
    lVInput = mPositionTargetSpeed;
    }



    It won't support strafing or running backwards, but I expect I'll evolve it to do that later.

    In the code I'll be sharing soon, the Behavior Designer action supports climbing to get to the PositionTarget if needed. That's something you'll be able to use as well.
     
  26. jcdenton2030

    jcdenton2030

    Joined:
    May 4, 2014
    Posts:
    4
    Stan, quick question for you. Really appreciated the demo. Maybe I'm trying to take a tank to a knife fight on this one, but the ledge grab and mantle you have in the controller is exactly what I wanted. I wanted to a 3d character set against a 2d world/background. Do you see any difficulties applying the character here to a 2d city environment, setting up colliders against the edges of the buildings, it's ledges, arches etc such that the 3d character in the asset could traverse them with the in the ways available in the demo? Run, walk, jump, idle, stealth, jump and hold, mantle, climb over. These were the animations I was particularly interested in. Basically can I apply them against a 2d backdrop so it appears as if a 3d dude is running against a 2d background?

    Cheers, and keep up the awesome work
     
  27. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hi JC,

    Thanks.

    I'll say it a little different than you put it, but hopefully it will make sense...

    If your world had 3D geometry with colliders, than your 3D character will work with the Motion Controller. It won't matter if your camera is orthographic (showing only 2 dimensions) or if your background is a 2D image. As long as there is 3D geometry to stand on and shoot raycasts against, you're good.

    You'll have a little bit of work to get the camera to stay how you want it, but you probably expected that.

    I hope that helps,
    Tim
     
    Last edited: May 10, 2014
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I've had several requests for video tutorials. To be honest, I haven't done one before and was a bit hesitant. But, I bit the bullet and got two of them up for you.

    1. Getting the demos up and running


    2. Setting up a custom character



    So, let me know what you think... too much info, too little info, too slow?

    If you have a request for a specific tutorial, let me know and I'll get it up when I get a chance.
     
  29. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    As I've mentioned before I was able to fix some major issues with multiplayer and now my network controller for Motion Controller works as expected. I'm sending keyboard/mouse input by network to simulate user input on remote model.
    Check out my Youtube video with 4 clients:


    Web Player Link(try to run at least in 2 browsers to see how multiplayer works):
    http://exposedconflict.com/web/web.html
     
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Stan, that is completely awesome! I was able to open it up in two browsers and see both the guys. Very very cool!
     
  31. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    Videos are good but from my point of view video tutorials are the last think to do, especially given the quality of existing documentation. If you target your project for the advanced users and developers(to be honest I do think it's good for beginners at least at this stage) videos are not needed. Personally I hate video tutorials and always prefer PDFs. Please work on the new motions, improvements and new functionality. Your asset is the best mecanim controller so far and I see the great potential for the future grow.
     
  32. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Thanks Stan, I appreciate the feedback.

    It's funny though... I get emails from people that really want videos and some that want more PDFs. The same thing with motions and features: swimming, flying, shooting, climbing, ropes, IK, custom collision boxes, cover systems, etc. I'm learning I just don't have enough hours in the day. :)

    No complaints... it's very cool that people are finding the assets useful. I just wish I had the time and resources to get to them all.

    Thanks again for the compliments... I really do love making games and tools! :)
     
  33. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    The tutorials are great!!!

    Well done man.

    Any thoughts on adding ps3 or 4 controller support?

    I'm going to add the inputs myself, just thought it'd cover one more major system and input people use, not to mention it'd be a great selling point.

    Just food for thought.
     
  34. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Thanks Kurotatsu!

    I'll looking into it. If it's just a matter of using some different inputs, that would be easy.

    How are things coming with Voidkeeper?
     
  35. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    Well thus far, I've written a ranged system for Motion Controller, that uses a bow and magic( it's about finished.).

    I'm finding that adding the double jump is next to impossible(for me anyway, too many animation changes to compete with.lol) using the current jump, I'm thinking of simplifying the jump based on direction and velocity. We'll see what how it turns out.

    Here's some quick references I found, still have to test.

    I'll post a video once I finish the ranged controller, and the double jump.

    Ps4 controller:

    https://www.youtube.com/watch?v=XkRWyxMhNak

    http://www.reddit.com/r/Unity3D/comments/1syswe/ps4_controller_map_for_unity/

    Ps3:

    http://forum.unity3d.com/threads/89288-PS3-Button-Map

    http://armedunity.com/topic/523-using-a-ps3-controller-for-your-game/
     
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    That is absolutely awesome! Can't wait to see a video. :)

    I believe someone did get a double-jump working. He's got some pretty cool parkour going on. You're right, the jump is pretty complicated and I had to help him wade through it. You may want to just simplify the jump.

    Thanks for the references too.
     
  37. Goldrake

    Goldrake

    Joined:
    Feb 6, 2010
    Posts:
    148
    Hey Tim,
    when do you think will be ready the behaciour designer compatibility with some examples? :)

    Thanks!!
     
  38. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    Hi Tim,
    could you put a complete pack on the asset store, just like SECTR does? The reason being I have your mount points free as I bought MC and CR but I would like to support you and buy a complete pack instead of everything from you in single packages.

    And I use Behavior Designer too.
     
  39. Tryz

    Tryz

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

    Opsive (the creator of Behavior Designer) and I are currently working on an example scene right now. All the basic tasks are in place and seem to be working pretty well, but we're trying to create a demo that others can follow to implement their own AI to drive the Motion Controller. So far, it's coming along pretty well.

    I'm guessing we're several weeks away from a true demo/tutorial.

    That said, I'm going to submit a new version of the Motion Controller on Monday that will have the basic Motion Controller specific tasks available for use with Behavior Designer (assuming you own it). It just won't have the documentation or example scene ready.

    If you want the tasks/actions before then and are feeling brave, shoot an email to tim@ootii.com and I'll send them too you so you can play with them. To be honest, they are super easy to implement and follow the standard BD workflow.


    Interesting, I hadn't seen that before. I see what you mean with the SECTR Complete. I have to think about how that would work...



    Some things in the up coming release:
    1. Basic Behavior Designer specific tasks/actions
    2. Smarter support for raycasting (ie ignore trigger volumes)
    3. Performance improvements (although I want more)
    4. In-editor help and tool tips
    5. Enhanced 'bumper' support for sliding against walls
     
  40. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    I vote for the complete package as well. The reason is if I decide to create my own TPS multiplayer asset it will depend on at least 2 of your packages: Motion Controller and Adventure Camera and Rig(may be Mount Points as well)
     
  41. BGog

    BGog

    Joined:
    Feb 10, 2014
    Posts:
    10
    I'm having a little trouble and thought perhaps someone has some thoughts.

    I have my character working with the motioncontroller and the motions/animations from the demo. However, in my game it is a top-down game where the camera doesn't follow the character. I can't get any forward or turn motion when using my camera because the motioncontroller script 'return null' when the camera isn't set.

    The motion controller seems to be setup to only allow a camera that follows the player and that all inputs are relative to the camera angle. I would have expected a camera rig to be responsible for this.

    Is there a way around this? I assumed that in this framework the motion controller script was intended to be unmodified and that all code would be implemented through the motion scripts. I can rewrite some of the motion controller to do what I need but then am I locked out of any updates to the motion controller framework?

    Thanks much.
     
  42. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
    I recently found very good package from Unity "Sample Assets (beta)" that contains pretty decent mobile controller. Because I was wondering how the Motion Controller looks on mobile I decided to spend some time and test it on my old Tegra 2 android tablet.
    Changing the code was really easy because all inputs are only in one file - InputManager.cs. I just replaced all UnityEngine.Input with CrossPlatformInput like:
    Code (csharp):
    1. UnityEngine.Input.GetAxis("Vertical");
    2. to
    3. CrossPlatformInput.GetAxis("Vertical");
    Than I added "Mobile Dual Stick Control Rig" prefab to the scene and cloned Jump Button control to Fire1 and Fire2:
    $mc1.jpg

    I've tested it in multiplayer mode and with 1 or 2 players fps was about 30(without any optimization), with 8 players it dropped to 24(it's actually not too bad)

    if you want to test it, here is link to the APK file(multiplayer version):
    https://www.dropbox.com/s/n1oqw5d5cjfuvrl/test.apk

     
    Last edited: May 24, 2014
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hi BGog,

    I see what you're saying. I did build the motion controller with a third-person camera in mind, but you're right that it should work with any camera setup including top-down.

    I'm going through the code and Animator looking for where the "_CameraRig" or "InputFromCameraAngle" is required and it's pretty minimal.

    First thing...

    You can change the condition in the ProcessInput() function safely from:
    if (_CameraRig == null) { return; }

    to:
    if (_CameraTransform == null) { return; }

    I'll do that for the upcoming release so I won't over-write you later.

    You always want to set the 'Camera Transform' property on the Motion Controller. This way I can try and grab the camera angle, but I don't use it to set the controller's position or rotation. It's purely to store a reference for the input that is relative to the camera in case it needs to be used later. In your case, it would be worthless and you wouldn't want to use it.

    The reason I do that in the Motion Controller is so we can store the input information as part of the state information. This gives us a 'previous' and 'current' state that can be queried and acted on. In this way, you can see how quickly the player is wanting to rotate the character or the change in velocity. That said, only the jump motion is looking for 'InputFromCameraAngle'. You could change this and create a new motion (ie Jump2) safely.

    Feel free to email me and we can work through all this. I'd like to try to make the Motion Controller as camera agnostic as possible. Email tim@ootii.com.


    Stan, you so rock!! That is awesome!

    I don't have a mobile setup to test here, but I know some people are using it that way. I love that you got it up and running and have stats. Very...very...cool.
     
  44. BGog

    BGog

    Joined:
    Feb 10, 2014
    Posts:
    10
    Thank you Tryz. I'll try this out and let you know how it goes.
     
  45. Stan-B

    Stan-B

    Joined:
    Aug 5, 2013
    Posts:
    126
  46. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Stan, that is totally awesome! I can't thank you enough for sharing that with everyone.

    It's very cool watching what people do with the Motion Controller. I'm finding that as I use it in my own game, there are things that I want to add and improve as well. That's why I'm focusing on NPC AI right now.

    It's cool that you're focusing on the networking aspect!


    As a side note for everyone else, the latest version is up. Here's what you'll find:

    05/19/2014: Version 7

    - Motion Controller specific Behavior Designer actions
    Note this requires Behavior Designer from Opsive and is an initial release for those brave testers interesting in implementing AI with the Motion Controller. Documentation and improvements are coming.

    - In-editor help and tooltips
    - Better front-bumper support
    - Minor performance improvements
    - Fix to ignore trigger volumes on raycasts
    - Fix where running off object sometimes freezes animation
     
    Last edited: May 26, 2014
  47. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    Q: Is there anyone here making motions at the moment? Anyone out there?

    I like your videos. I could have done with them earlier, but that’s life. It will help others to get started quickly.

    Q: A nice video explaining and showing us how to make our own motions with help to follow the doc better as I am still a little confused. Just do one with firing a gun or throwing a grenade. The quicker we learn that, the quicker people start posting motions.

    Q: Yes motions? Somewhere organised to be able to post them would be great, as here they will get scattered in different posts.

    Q: How can I have random idles going and differ jumps?
     
  48. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    I tried to go through your Build motions doc and add the crouch, but I get this error and do not know how to fix it.

    Assets/ootiiMotionController/Scripts/ootii/MotionController/AI/Controllers/Motions/Crouch.cs(53,33): error CS1061: Type `com.ootii.AI.Controllers.MotionController' does not contain a definition for `IsMovingToTarget' and no extension method `IsMovingToTarget' of type `com.ootii.AI.Controllers.MotionController' could be found (are you missing a using directive or an assembly reference?)

    Monkey is running about but now he should break dance and get loads more motions.
     
  49. blockcipher

    blockcipher

    Joined:
    Jul 4, 2013
    Posts:
    19
    Hey Tim,

    Nice work on the new release, as always! I am having some trouble with the BD element though, specifically the demo project. I dont think the BT saved correctly because it gives me dictionary errors when I try to view the behavior tree for the NPC. Im just beginning to use BD so I cant give much insight on it, but the errors are a KeyNotFound exception. I tried it with the designer open and closed. Maybe the demo didnt save the BD values correctly?
     
  50. Tryz

    Tryz

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

    Haha... I get a fair amount of emails, so I know some people are. :)

    Now that I have a fancy new microphone, I will do that this week. I've been making some goblin motions. So I'll use one of those as an example. :)

    I had thought about creating a simple library on my site, but to be honest I wasn't sure if anyone cared. When I do the video above, I'll put together a simple page and actually share the motion as a new download. This way, I can do a video on importing someone else's motions too.

    Good question.

    Since the starting point for all motions comes from the 'Any State' in your sub-state machine, you'd simply have multiple animations come off of that state: Idle1, Idle2, Idle3, etc. Each one would have a different Motion Phase ID: 100, 101, 102, etc. In the Activate() function of your motion, you'd randomize the Motion Phase IDs and call SetAnimatorMotionPhase() using the Motion Phase ID that you picked.

    Hopefully that didn't sound too technical. If you're getting familiar with motion building, the Motion Phase ID and SetAnimatorMotionPhase() function are pretty common.

    That was a documentation error. I removed the function a while back and didn't remove it from the documentation. I just updated the documentation, but this week I'll go through it all again and make sure everything is synced as it should be.

    Sorry about that.

    hahah... and this is why I love games. :)


    I went ahead and created a new project and I'm not getting any errors. Here's what I did:

    1. Created a brand new project
    2. Downloaded and imported the Motion Controller from the asset store
    3. Replaced the InputManager.asset file
    4. Imported the ootiiMotionControllerBD.unitypackage
    5. Got errors because I forgot to import Behavior Designer :)
    6. Downloaded and imported Behavior Designer from the asset store
    7. Opened the BDScene1 scened from the ootiiMotionControllerBD Scenes folder
    8. Clicked on NPC1
    9. Clicked on Open Behavior Designer

    This is what I saw:
    $BehaviorTree.jpg

    Then I clicked on the 'Traverse Patrol' node and the 'Inspector' tab at the top of the window. I saw the two patrol points (the blue boxes in the scene) and everything ran as expected.

    Given the error, I would think what you're seeing is tied to the Waypoints array not being filled out.

    Are you able to get to this point in the editor at all? I'm curious if the KeyNotFound relates to the waypoints array.
     
    Last edited: May 26, 2014