Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Motion Controller

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

  1. luekio

    luekio

    Joined:
    Jan 23, 2018
    Posts:
    17
    @John-Lisenby

    Sorry, should have mentioned I tried without the actor driver originally (and again now). No luck. When I hit play my character sinks halfway into the floor and freezes.

    The rig is set to humanoid. No errors.
     
  2. luekio

    luekio

    Joined:
    Jan 23, 2018
    Posts:
    17
    Okay, I figured it out. The motion control was defaulting to use humanoid as the animator instead of MC_humanoid1...
     
    Tryz, KeithBrown and hopeful like this.
  3. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    110
    Hi Tim,

    I'm using an asset called Game Creator (lots of users on their discord asked the creator to work on an integration module with Motion Controller; so you might hear of it sooner or later)
    This asset has a character controller and its own animator. While I don't want to use it for the movement/combat part and keep Motion Controller + its extensions, I do like some of the features of Game Creator that moves players or NPC to specific spots based on simple actions and conditions.

    Nevertheless here is not the place to go into those details. So as there is no integration I found an alternative to keep using MC:

    The scene is like that: there is a trigger, when the character enter the trigger the 3rd party asset will move the character to a position; using NavMesh agent.
    So I've made a simple Bolt flow that says: when Player enter the trigger, please enable in Actor Controller "Use transform + rotation"
    So far so good, my character switch to use transform, I can't control it anymore and it goes to the position. Then a bool send the information that the character arrived and I disable the use transform to get control back.

    My character walks there when using the Nav Mesh agent (which is intended). But on the MC I've set to auto run when I control the character.

    When I disable the "Use Transform" my character speed is only walking. I've tried to disable/enable auto run again or even disable/enable the motion: no change; it keeps on only walking, can't run anymore

    Would you have an idea why is that?

    Edit: here is a quick and dirty video example of what I just said:
     
    Last edited: Jun 6, 2018
  4. devoncode

    devoncode

    Joined:
    Mar 11, 2018
    Posts:
    9


    This was the out of box experience for me too for the interaction demo. You can only interact with the door and then only once. Remove the raycast and it works.

    I tried it on two different systems:
    (Unity 2017.3.1f1 (64bit) PC, Mac, & Linus Standalone)
    (Windows 7 & Windows 10)
    (.Net 4.0.0 & .Net 4.7.2)

    BTW: LOVE the Product!
     
  5. devoncode

    devoncode

    Joined:
    Mar 11, 2018
    Posts:
    9
    I'm pretty sure this is an issue on how Unity handles weak collisions. If you turn on "Allow Running Vault", you can leap into walls. Any Idea how to prevent this because I think the Running Vault feature is awesome.

     
  6. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    110
    If you check those walls in the demo scene they have no layer (at least for me)
    You need to add them to a layer and in the actor controller add this layer to the collisions

    If you put those walls into the default layer it'll not go through anymore

    edit: my bad, still goes through. I guess it's because it's animating
     
  7. devoncode

    devoncode

    Joined:
    Mar 11, 2018
    Posts:
    9
    Yeah that was my original thought as well, but turns out they are set up fine. I can't jump into them or walk into them. They are even climbable. If you look closely at the end, I'm actually stuck inside the cube ( without layers I could walk out). It only happens with the running vault. The way I fix it is simply adjusting distances between vault wall and other walls, however, am thinking of running a raycast check during the vault to make sure there is clearance so that it's automatic. Not sure if there is a better method on handling that.
     
    Tryz likes this.
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    Hey all. I'll be back from vacation in a couple of days and catch up. Internet is sparse at best.

    Thanks for being patient.
     
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    I'm finally back. Give me a day or two and I'll catch up on these posts and all the emails. :)
     
    Necka_ likes this.
  10. The_Darkwing_Duck

    The_Darkwing_Duck

    Joined:
    Jun 16, 2017
    Posts:
    20
    Sorry to overwhelm you, but how would I be able to connect the health of my player, to a healthbar?
     
  11. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    All good. I just finished answering all my emails and I'm just starting on the forums. :D

    It really depends on how you do your health bar. As you can imagine, there's tons of GUI assets and tutorials on this. In the end, they all (typically) have you set a value like this:

    Code (CSharp):
    1. HealthBar.value = 100;
    So, we would code something like this:

    Code (CSharp):
    1. IAttributeSource lAttributes = gameObject.GetComponent<IAttributeSource>();
    2. float lHealth = lAttributes.getAttributeValue<float>("Health");
    3.  
    4. HealthBar.value = lHealth;
    I "IAttributeSource" is typically the Basic Attributes component that is included in the MC. However, I use it as a IAttributeSource interface so you could create your own attribute solution if you want.

    I hope that makes sense.

    [EDIT]
    Just to start simple, I'd do this every update tick. This way if your character is injured or healed, the health bar is always accurate. Then, you can get more advanced and cache values to save some performance.
     
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    First... cool integration using Bolt. :)

    I think it may be the "TargetNormalizedSpeed" on the MC. When you give control back to the player, make sure to set:

    Code (CSharp):
    1. MotionController.TargetNormalizedSpeed = 1f;
    I change this value in the NavMeshInputSource. I'm guessing that it's set to 0.5 (for walking) and when you take over, the value remains at 0.5f vs 1.0f (running).
     
  13. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    That's Unity's default for when no animation is found.

    It's a bit odd that the "Humanoid" controller found in "Assets\ootii\MotionController\Content\Animations\Humanoid" would be missing animations. While it won't include animations for the motion packs, it does include everything for the base MC.

    That's fine too. However, "Humanoid" should work. I just tested and it does.

    Feel free to email tim@ootii.com if you want to dig into this deeper. You're moving forward and that's the goal. :)
     
  14. The_Darkwing_Duck

    The_Darkwing_Duck

    Joined:
    Jun 16, 2017
    Posts:
    20
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    I can tell by your video that you're not "looking" at the chest for example.





    This is what I talk about in the documentation.

    The raycast may be "too precise". Disabling it works because then the cast is no longer needed to trigger the interactable.

    The other option is to drastically increase the size of the raycast collider. This way you're in 100% control over where the ray hits. The Raycast collider doesn't need to be just the lid of the chest. It could be much bigger...



    In the picture above, notice the chest is highlighted. That's because the tall "RaycastArea" collider gave more area for the camera based raycast to hit.
     
  16. The_Darkwing_Duck

    The_Darkwing_Duck

    Joined:
    Jun 16, 2017
    Posts:
    20
    Btw, here is the code which you provided implemented into mine. Am I missing something? UpdateBar is a update function

    Screenshot (10).png
     
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    I was able to reproduce this too.

    I think I just need to do a much longer raycast test to see if the running vault is allowed into a wall.

    During the vault, I disable the collision temporarily. The running vault moves the character forward much faster and since the wall is so close the character is pushed through.

    I need to think about it more, but I've added the issue to my list.
     
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    You've put that in the "Start()" function. That means the code only runs once at the start of your game.

    If you want it to run each frame (which you do) you need to put it in an "Update()" function.

    https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html
    https://docs.unity3d.com/ScriptReference/MonoBehaviour.Update.html


    I'm not sure what arguments UpdateBar() is expecting, but if the first one is the current value and the second one is the max value, you're probably right.
     
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    I think I'm caught up. If I missed a question or post that I need to respond to, please re-post or email tim@ootii.com. :D
     
  20. The_Darkwing_Duck

    The_Darkwing_Duck

    Joined:
    Jun 16, 2017
    Posts:
    20
    Wait nvm I got it work, thanks!
     
    Tryz likes this.
  21. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    110
    You're caught up I think but let me add one more question: How was your vacation time? Hope you enjoyed :)

    On my side, I'll update my Bolt integration because you're right with the NormalizedSpeed, that's what is wrong, thanks for that
     
    Tryz likes this.
  22. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    Great time. We took a cruise to Mexico. :D

    Awesome!
     
  23. The_Darkwing_Duck

    The_Darkwing_Duck

    Joined:
    Jun 16, 2017
    Posts:
    20
    Could you add a sort of magical shield spell? Like to block, the porjectile? Or Chain Lightning?
     
  24. devoncode

    devoncode

    Joined:
    Mar 11, 2018
    Posts:
    9
    I understand what you are saying. ( I'm guy number 2 ).
    Thank you for posting those screen caps. It's nice to see what you are seeing as well.
    I very slowly walked around the chest and sphere, in out, different position, etc. and I couldn't get the highlighted marker. I even made another video to show that I was carefully examining it (haven't posted it but I can if you like). ( This personally isn't a problem for me at all but I wanted to give a bit of validation to the original poster that he isn't the only one that has seen this. )

    For the record, I couldn't be more happier with this product. The code is great and the support for it is stunning.
     
    Tryz likes this.
  25. devoncode

    devoncode

    Joined:
    Mar 11, 2018
    Posts:
    9
    Before I modify the code for this, does anyone know if there is a setting somewhere that I'm missing that will allow me to change between rectilinear strafing and default orbital strafing? The feeling I'm going for is one where the camera pans left or right behind the character strafing instead of the camera pivoting while the character is strafing.
     
  26. The_Darkwing_Duck

    The_Darkwing_Duck

    Joined:
    Jun 16, 2017
    Posts:
    20
    Yes there is, there is an object called Camera Rig
     
  27. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    592
    If you're using Camera Controller, switch from a 3rd Person Follow motor to a 3rd Person Fixed motor. That should give you the behaviour you're looking for.
     
    Tryz likes this.
  28. devoncode

    devoncode

    Joined:
    Mar 11, 2018
    Posts:
    9
    Perfection. I installed the Camera Controller and that worked perfectly thanks!
     
    Tryz likes this.
  29. devoncode

    devoncode

    Joined:
    Mar 11, 2018
    Posts:
    9
    Thanks. I installed the camera controller and that gave me the options and controls I needed. I'm stunned at the amount of flexibility this product has built in.
     
    Tryz, hopeful and TeagansDad like this.
  30. The_Darkwing_Duck

    The_Darkwing_Duck

    Joined:
    Jun 16, 2017
    Posts:
    20
    Alright I found out the problem, in the Spawn Projectile Node you said to set the distance to 20-25, edit that to make it 0-25. Otherwise it just stays there.
     
  31. The_Darkwing_Duck

    The_Darkwing_Duck

    Joined:
    Jun 16, 2017
    Posts:
    20
    I hope this helps anyone else that has this same problem
     
    Tryz likes this.
  32. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    It warms my heart seeing people helping each other. Thank you! :D
     
  33. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    498
    Hi Tim,
    I've got some climbing issues with motion controller.


    The collider is not a cube but with some slops on it:
    upload_2018-6-15_20-31-36.png
    My character is using climb-1m motion, when climbing cube colliders there is no problem, but when dealing with slopes it sometimes can not climb up to it, seems like the transform is stuck by something. I'm using an older version of Motion Controller and can not update it for now.
    Any work around to make the climb solid?
     
  34. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    My climbing motions require 90-degree-ish angles. It has to do with how I use raycasts to check for edges.

    I think what's happening in your video is that the edge is found further away at the top. The character tries to move to it, but the lower part of the collider (which is closer) is preventing the character from getting to the edge.

    With your mesh, you have some options:

    1. Simply make the climb-able colliders cube-ish by ignoring the angles a bit:



    2. You could also use separate colliders if you need to (one set to respect the shape for collisions and one for climbing).

    3. You can customize my edge-finding raycasts to compensate for the slopes. Disabling collisions earlier may help too, but that's not always a good option.
     
    TeagansDad likes this.
  35. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    498
    Thank you for the explanation!
    Is it possible for me to disable the moving part from your method? I don't need my character to snap in front of the object he's climbing but need him to be able to climb various sloped surfaces, like huge rocks.
    Where should I look into?
     
  36. luekio

    luekio

    Joined:
    Jan 23, 2018
    Posts:
    17
    Has anyone had any success with the crouch climb?

    I find it very tricky to trigger, and once I do get a char into crouch climb mode if I try to shimmy left/right he spins crazily then locks. It's a fairly simple surface, but I am using a mesh colider...
     
  37. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    I'm not seeing an issue.

    I just imported into a new 2017.4.3f1 project and opened my "demo_Climbing" scene. Then, I went to the large block on the left and jumped into the crouch climb. I could shimmy left/right with no issue.

    It's possible that it is your mesh collider if it's concave or has some odd shapes. The climb crouch will follow the bends and slants within a threshold, but I've never seen it "spin crazily".

    Any chance you're spinning the character with the camera or something?

    If you're confident it's not something else in your scene, you can send me (tim@ootii.com) a simple project with your mesh and a scene, I can look.

    [EDIT]
    Most games (even AAA games) don't use mesh colliders because they can be too detailed and expensive. Concave ones play havoc on physics engines too.

    Simplified ones (like what @Harekelas showed) aren't bad, but I'd suggest using spheres and cubes for your environment (and climbing) when possible.
     
    Last edited: Jun 15, 2018
    TeagansDad likes this.
  38. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    You can try, but it may cause issues in different stages of the climb. For example, you may find you climb up away from the ledge onto empty air... which will cause you to fall.

    If you look at Climb_2_5m.cs, you'll see "reach data" at line 357. I talk about this in the documentation, but it's a bit tricky. Basically I make small adjustments throughout the climb to make sure characters of different sizes look right as they place their hands, pull up, and finally stand at the top.

    Remember, I'm dealing with animations created by others and are given away for free... they are by no means clean or well aligned. So I make it work.

    If you have your own climbing animations that are clean, the motions would probably be much simpler to create.
     
    TeagansDad likes this.
  39. luekio

    luekio

    Joined:
    Jan 23, 2018
    Posts:
    17
    Thanks, Tim.

    I'll tried with a box collider instead. Bingo!

    My next goals are to add more detailed control within the crouch climb, and rolling landings on large jumps/falls!


     
    Tryz and hopeful like this.
  40. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    498
    I see, I'm using Kubold's movement animset pro. I've tried to disable the collision in Activate function, it works in most cases but sometimes still doesn't work. Dose the snap action executed in the ReachData? How can I only disable the initial snap but keep the rest so the character won't be blocked or keep the character further away from the climbing edge.
     
  41. luekio

    luekio

    Joined:
    Jan 23, 2018
    Posts:
    17
    Tim, any chance you will add motions for the "herioic traversal" pack to the motion controller vault? I think the are the best animations on the asset store to date!
     
  42. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    At the location I sent, you probably saw there were several MotionReachData allocations that get added to a list. Each one has a "StartTime" and "EndTime".

    The GetReachMovement() function in the Update() function then uses the MotionReachData list to determine which offset values should be used and when.

    So, not adding MotionReachData to the list (or changing the times) will keep it from being used.

    I'm not exactly sure what's going to happen once you stop the reach data from lining the character up with the edge.


    One last note...

    In the documentation, I talk about the reach data (page 21) and how it's used for each climb. Typically, you wouldn't need to touch these options, but you may find that adjusting the values in the editor work so you don't have to modify any code.

     
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    I don't own them myself, but I have seen them and they look great.

    Unfortunately, my biggest issue is time.

    I'm buried in some client work and support right now and I've got new asset that isn't getting any attention. So, while I'd love to... it won't be for a long time.

    Fortunately, you should be able to add the animations to the "basic" motions (Basic Idle, Basic Walk Run Pivot, etc.) pretty easily. Check out this video:

     
  44. luekio

    luekio

    Joined:
    Jan 23, 2018
    Posts:
    17
    Thanks for the reply, Tim.

    Yes that is actually what I did already. I've been trying to integrate more complex stuff with some luck, but I've got a lot to learn!

    Any suggestions on the best way to trigger a roll to falls/jumps of larger heights?
     
    Last edited: Jun 18, 2018 at 12:18 AM
    Tryz likes this.
  45. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    The Jump and Fall motions will land automatically, but you could force another motion to activate at a specific time (say when you hit the ground).

    So, you could create a "HardLand" motion whose TestActivate() function is checking if the current motion is Fall. If so, you can keep testing to see if you are grounded (using the Actor Controller).

    If you weren't grounded and you are now, you know you just hit the ground. You can check the age of the Fall motion to see how long it's been falling. At some point, you would determine you want your HardLand motion to activate.

    Then, you just force it with:
    MotionController.ActivateMotion(YourHardLandMotion);

    If you follow the Motion Builder's guide or my video on creating motions, they will fill in the specifics.
    http://www.ootii.com/unity/motioncontroller/MCMotionBuilder.pdf
     
    TeagansDad likes this.
  46. luekio

    luekio

    Joined:
    Jan 23, 2018
    Posts:
    17
    Thank you!
     
    Tryz likes this.
  47. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,349
    I'm back to using Motion Controller again, for my Android game, we aren't using for our PC , not my choice. But when I can, I still plan to post some stuff, in the future, this game has been close to being done, but sadly I had to put it down due to other commitments. So I will be working with it again Part time. starting next month. to finish my game. I have many integrations, (Bolt, (Sky Master, Water, Weather, Related)NWH Vehicle Physics , Apex Path, and many more. Many are done, but I need to update a bit, with 2017 and 2018. Since I have not worked on it since 5.6. I have a ton of others. . so I still like to post some stuff on the Vault. when i'm done though, not until as I don't want people with any issues. Thanks. Not sure when it will be done, but no matter what I plan to release the game this year on Google Play store, much of this will work fine for PC. its mainly controls that will be different.
     
    Tryz likes this.
  48. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,766
    recon0303 likes this.
  49. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    110
    Ah, Recon, so now I'll see you on all our common Discord channel and here too :D Hope to put my hands on your vault products soon ;)

    @tim and anyone good with that:

    How would you handle weapon hit particles with Motion controller?

    I have many ideas, but I can't wrap my head around one that would be clever enough to work properly.

    Basically for example I've setup a Combo system in MC, I've got 4 1 hand swords animation that uses the Chain event system, works great even though I've got a question about that (after).

    How it works is that the first slash is a normal damage modifier, then each additional combo will be more and more powerfull. So I want to spawn a slash particle X on the combo 1, a slash particle Y on the combo 2 and so on.

    The particles are like trails that spawn from the sword (like we see in most games today)

    Should I use the message system from MC, should I intercept what motion is played and spawn my particles kind of manually? Or I also saw that we can use State Machine Behaviour that are scripts attached to the Animator state machine (I'm worried about performances too)

    I'm just wondering what you guys (you have more experience than me) would use

    My second question is related to the animation speed, it might be a bit off topic from Motion controller though, but many of you are good with animations stuf :)

    I'd like to have the possibility to slow down a slash animation when the OnAnimationEvent "BeginChain" starts; the idea is to help the player to chain their attacks without being too frustrating; so basically let say my slash is 1.5 seconds long, it might become 1.7 seconds but only the last part need to be slowed down.

    I'm afraid I might need to manually move the keys in the animation window to do that; but I though maybe there is some kind of playback speed that can be updated on runtime or something like that

    thank you
     
  50. aLeXmOrA

    aLeXmOrA

    Joined:
    Aug 23, 2013
    Posts:
    9
    Hi @Tryz

    I've been trying to make a ladder auto-climbable by setting to blank the Action Alias in the Motion Controller.

    That part works well. When my player gets near the ladder, it starts climbing without any button. However, when it reaches the end, the motion seems to end but it starts to climb down the ladder automatically and when it reaches the bottom, it starts to climb up again.... loop.

    Don't know if I have to set some distance or a flag somewhere, so it doesn't start the motion automatically after reaching the end of the ladder (up or down).

    Thank you in advance for your help.