Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Motion Controller

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

  1. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    @Tryz Just a long time user of all your products, paying it forward, keep up the great work.:)
     
    Tryz, TeagansDad and antoripa like this.
  2. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634


    WOW, Thanks, I been gone this week, and nearly missed this post...I never heard of InControl... I don't have rewired either, I made my own Input Controller, but once inawhile some of my games we tend to miss some odd ball controllers....So I been looking for a better one... dunno how I missed this asset....Thanks allot of mentioning it....I develop for mobile alot, and we always add controller support since people want it. Thanks again!
     
    Tryz and kurotatsu like this.
  3. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    No prob, now you can code input once, and mobile support is just there.;)

    It saves development time for sure.
     
    Tryz and antoripa like this.
  4. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    yup. Never seen that asset before the bad thing about the store so easy for some to get lost, so I like when people talk about them.. otherwise some of us would never know...It also benefits assets such as Tim's..


    By the way Tim, I love the new branding of the Camera , I will pick that up soon for the heck of it and give it a whirl, since you have so much more than just a third person camera.. Very cool.
     
    Tryz and kurotatsu like this.
  5. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Hi, I just got MC and trying to set it up with NodeCanvas or Behaviour Designer using Unity's NavMesh Agent. I went throught videos on related topics and it seems to me that it is not possible to use higher level nodes of those BT packages like Wander for example, because they "talk" directly to the NVA component while MC requires talking to either NavMesh Input Source or custom Nav Mesh Driver. Is that correct? I really hope I am wrong or there is simply a way around it as BD provides movement / tactical addons that we would really like to use. Cheers!
     
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hi @slimshader ,

    I'm not sure if you've seen the Node Canvas actions I created for the MC. You can download them here from "The Vault" (under shared code):
    http://www.ootii.com/UnityMotionVault.cshtml

    In it is an action (NavigateTo) to move to a specific position or target using the NavMeshAgent's path. If you look at that, I think it will make sense. It's very similar to what I do with NavMeshInputSource.

    Basically, I get the NavMeshAgent's path and use the next waypoint with the MC's SetTargetPosition() function.

    So, you could do the same thing with any solution as long as it gives you a point to go to. You just grab the next target position and use one of the MC's functions:
    SetTargetPosition()
    SetTargetVelocity()

    (That package was done a while ago and not with the latest version of NC. I think it should be fine, but just a heads-up.)
     
  7. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Hey, yes I've seen them and it while it is OK example on how to replace MoveTo it is just small part ow what those packages provide. Simplest example would be Wander node in NC for example. This node makes an actor to pick random destination and then go there using NMA (and repeat), same with Patrol which follows provided waypoints. And those are only very basic "higher level" nodes. BD provides whole set of Movement, Tactical and even Formation-based movements all using NMA internally
     
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    For now, I just focused on the foundational actions.

    I've been able to do all my movement-based AI work with just the NavigateTo and ActivateMotion tasks. It should be a snap for anyone to pick a random point or manage a list of vectors to mimic the wander node (with NavigateTo as the foundation).

    That said, I do plan on doing more AI work once I'm done with Sword & Shield. But, as of right now it's what you see.
     
    antoripa and TeagansDad like this.
  9. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    That is very unfortunate :( I really don't think that adding AI to MC is the way to go. I would like NC and BD developers to focus on what they do best and be able to use it with other assets. Ideally MC would just read all the info (like NMA Driver does) from NMA and translate it to MC input.

    Again, Wander and Patrol were just most basic examples that are availabe out-of-the box in NC, BD contains much more complex behaviours, rewriting them simply isn't practical :/
     
  10. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    Hi @slimshader ,
    I used MC with Opsive Behavior Design. If you have a developer skill, you can write a wrapper actions like those for Opsive TPC ( Movement Pack ) and using for MC Command the Action for NC on the MC Vault. Effor is one hour.
    I would say that you cannot compare TPC Opsive and MC Ootii, They are quite different so far, with MC more focus on the concept of Motion quality , ability creation as an open framework. Both are excellent, but with different scope.That's my opinion.
    I spoke to Justin from Opsive few weeks ago, and he wrote me that Tim from Ootii in the past wrote some action for BD .. @Tryz if you still have those actions I can quickly review those action and send back you to share with everybody
     
    kurotatsu and Tryz like this.
  11. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    I did not try Opsieve TCP as I went with Ootii's MC. I am super sceprtical tho that Follow behaviour from Tactical BD pack is anything close to 1h. I do know what the difference is between motion controller and AI package. My point is that at the moment MC design makes it harder (to impossible without custom nodes) to integrate with AI solutions because it overrides NavMesh Agent controller.
     
  12. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Also, I don't know if you saw BD's recommandations for Mecanim sync but it basically says that while BD does support talking to Animator, it is not recommended (which is good recomendation) but instead a component sould be added to actor that polls NavMesh Agent and translates the velocity etc into calls to Animator. That is what I think sould also be happening here. And in fact it is mostly is, the problem I see now is that movement target has to be set on NavMesh Driver.
     
  13. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    To sum up and clarify: to get AI-driven motion with Mecanim animations without MC: the only thing that is needed is small custom Monobehaviour that polls from NavMesh Agent and sets the Speed / Direction etc parameters in the Animator to trigger animation SMs. NavMesh Agent is the controller that does the motion. Done.

    When using MC, one needs custom nodes (for every AI solution), then a NavMesh Driver still polls NavMesh Agent and then , from what I understand - MotionController overrides that motion (because that is the de'facto controller).

    I knot the reason for this is the input/driver based-design of AC/MC. Input is polled every frame to feed the Driver but unfortunatelly NavMesh Agent IS a controller and is not easily translatable to Input source.

    I would really like to us MC because of the quality of the motions but without a solution that does not force to rewrite AI packages it is very hard to proceed (player-input driven motion is of course superb tho).
     
  14. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    That's correct. BD just "drives" .. but you have to use the mechanism in your character.. in that case MC. You need ain Input Source for MC that receive command from BD. You can have a look to the NavMesh Input Source from MC. Idea is that DB replace human controller, but at the end actions are the same but not coming from keyboard(joystich. Indeed coming from DB
     
    TeagansDad and Tryz like this.
  15. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    I think I've made it clear that I understand the machanics ;) I need solutions now ;)
     
  16. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    It is high level mechasism. But when you go in details you have to handle a lot of varables, like steps, obstacle, fall, etc. That's becuase I suggest to use packages like MC that handle pretty all variables and you can even extend creating new motion/ability to fit your game needs.
    . BD or other AI tool ( I use even ICE Creature and concept is similar ) ideally just output a command. Those commands go to your input source layer that pass commands to MC. Principle is the same when you use the keyboard where command come from human player, go trough Input Souce to MC that's high level flow. High level flow ( we should mention even AC but we can keep out for now )
    Excellent choise ..
     
    recon0303 and TeagansDad like this.
  17. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    Solution cannot come from me ... I can just share my experience and my view.. Tim from Ootii can add more ...Thanks
     
  18. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    I actually also will be using ICE for wildlife in the game (BD for NPCs). Did you actually managed to integrate ICE with MC? Because again, ICE uses NavMesh Agent (obviously), and again an AI package has to be extended / modified to support motions with MC. Have you ever made any complex AI / NPC behaviours with MC? Demoing custom NavigateTo node is nice but the simple demostrated sequence is not an AI.
     
  19. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    If you use ICE only for NPC wildlife you do not need MC for motion. In that case ICE handles directly the animation from the animator control ( with or without Root Motion ). ICE has even an internal moving memachanism that works without NavMesh including grounding and obstacle advoidance. And that mechamis is a valid option in case of procedula world where you cannot bake in real time as MavMesh limitation. NavMesh is just a "pathfinding" and you can even use others like A* or Apex Path ( last has my preference , but is quite complex )
    My AI principles are abstract. I use 2 approach : Behavior Tree and GOAP with a scoring system. Whatever tool from Unity is just and implementation. You should focus on one important concept : AI and Character Controller are not related from logical point of view. You have your AI tool ..whatever is .. you get the output commands ( like move ahead, change weapon, attach, seek for health , etc ) and trought an input source give those commands to your character ...
    So, that is becuase when you have a MoveTo ( or SetDestination ) Action and a ChangeAbility Action you can do a lot. Those give you a lot ... further is more fine tuning or handle high level details .. and from my experience is going to come parallely to the evolution of game coding
     
    Tryz likes this.
  20. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    I know all of this, but it is not what I asked about. I bought MC which is suppose to control animals also (I may not use ICE and that is not even the point), my problem is, it is hard to integrate with ANY AI solution.

    Yeah, and yet MC foreces you to implement BT nodes to make it work together. And while they are orthogonal in theory, one drives another.

    But that is just a theory of how things should be done. There no "commands" in Unity that can be sent to Mecanim. Asking about practical advice. And I don't think they give a lot at all. They are not abstract commands. They are specific code calls that are not reusable. Have you ever seen for example Formations package for BD? In which units follow the leader in specific formations, keeping distances and adjusting speeds related to one another?

    Don't get me wrong, I really appreciate your advice, but that does not translate to solutions wrt to mentioned packages.
     
    Last edited: Oct 27, 2016
  21. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Wow... I need to catch up.

    We totally got disconnected.

    I have no interest in creating my own unique AI system. I think NC and BD are great and I don't want to reinvent the wheel.

    What I mean is that I plan on re-looking at how I can integrate with NC, BD, and PM better.
     
    TeagansDad and antoripa like this.
  22. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Ah cool :) From my PoV the only thing that MC would have to do is to provide a bridge like NavMesh Driver but that it would be completly self-sufficient and was able to pull all the necessary motion information from NavMesh Agent. I'll be happy to help with ideas and testing.
     
  23. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    I gave you the solution. But I think that you are still assuming that BT or NC should implement the animation.
    That is evident when you say "There no commands in Unity that can be sent to Mechanism.."
    BT send a command to MC Inputsource..that pass it to MC. That's. For movement and for Motion ( jump or swim, etc)
    From my position I cannot add more. Thanks
     
    Tryz likes this.
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I've been through the whole thread.

    Thanks @antoripa for helping! I really appreciate it and everything you said is correct. ;)

    @slimshader , In my approach with the NMA, the NavigateTo task, NavMeshInputSource, and NavMeshDriver are the bridges. The MC stays in control, but pulls its destination information from the NMA.

    I know you said it's hard to implement AI with it, but I don't believe it is. Using the simple tasks and conditions I've included, I let NC and BD do the hard AI work. Sometimes building the BTs can be tricky, but integrating with the MC really isn't. Have you tried it?

    Here's some videos that show it in action:






    Others have posted videos on the forums too.

    I understand the approach you're talking about, but I doubt I'll implement it that way. You can, but that doesn't feel right to me.
     
    TeagansDad and antoripa like this.
  25. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    I don't know how you concluded that, especially that I even mention that BD author himself does not recommend animating from BT. My "commands" comment was with regards to your previous "command" mention.

    My point is, those AI packages DO use NavMesh Agent direclty, not that I think they should but that DO use it and there is (unfortunalty) nothing that can be done about it.

    As I asked, did you see mode complex stuff, like Formations package from BD?
     
  26. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    I saw all those videos and read all the docs. NC demo uses custom nodes, BD video does not show the tree at all but I assume it is no more complex.

    Again: I am not saying MC is not good for use with AI, only it is hard to make it work with NC and BD just because they talk to NMA directly.
     
  27. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Ideally those AI packages would "talk" to abstract controller interface, then it could just be implemented to drive MC, my only point is that they don't so the only channel of communication between them and MC is the Transform and NavMesh Agent. Since it is practically impossible to rewrite AI nodes (NavigateTo is really just tiny thing), the only practical solution I see is to extend MC via its Input/Drivers (as only thins asset predicted different implementations)
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I think that's the part I'm not understating.

    In my NavigateTo task, I don't rely on the NC talking to the NMA. My task reads from NMA directly and passes that info to the MC... NC really isn't involved with that.

    At that point, NC is just a container to start and stop the node.

    So, what I do in my BTs is have a node that determines where to go and set a value. Then, the NavigateTo task reads the value and tells the MC to go.

    You are correct. There are some for knowing when to attack, visualizing the player, etc. But the movement is actually NavigateTo and the execution of the attack is ActivateMotion.

    Good point.

    When I get back to beefing up the AI, that's what I meant. More conditions and tasks (as needed), showing how to do some BTs, and maybe some pre-packaged BTs.
     
    Last edited: Oct 27, 2016
    TeagansDad likes this.
  29. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    When talking about things like combat and interactions, that may be a good option. It depends on what you're trying to do. I've found I can do a lot with just NavigateTo and ActivateMotion.

    Let's approach this a different way.

    Can you give me an example of some (semi-simple) behavior you would want to do? I'll see if I can explain how I'd implement it.
     
    TeagansDad and antoripa like this.
  30. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    I see a big missunderstanding. I have never said ti animate from BD .. Obviously does not make sense. I am trying to expalin that BD output is a command to your character controller to trigger an animation. That command is the result of an Action. Currently I use BD and Formation Add On with creatures. I am using MC with 5 dragons that on the ground walk in V formation..I have not changed any single line of code in MC, but just sending 2 new actions from BD to the NavMesh Input driver. That's all the folks. I do something simimar with other creatures like wolfs and bears, but in that case I do not use MC. I hope that the above can help you ... If now I would suggest to check with the author of BD as your question is more related to that tool than any character controller .. that's my opinion ... thanks..cheers.
     
    TeagansDad and Tryz like this.
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Whew... exciting morning here. :)
     
    TeagansDad, kurotatsu and antoripa like this.
  32. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    I'm writing an AI as we speak to sell(I'm close to satisfied with the features now to release soon), I'll look into the NavMeshInputSource, and NavMeshMoveTo.

    I doubt it will be very involved to drive MC with my AI, I'll just have to make some minor changes, and as I've written more than a few systems that wrap MC, just by using the included parameters/variables in the animator included with it, I'll see what I can come up with.
     
    Tryz and TeagansDad like this.
  33. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    I don't think he's the real @slimshader. He's just imitating.
     
    Tryz and kurotatsu like this.
  34. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    My daughters name is Shae, and I sing that to her all the time.lol
     
    Tryz likes this.
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I understand what he's wanting to do now.

    There are actions and new AI assets that do a lot of advanced stuff. They result in moving the NavMeshAgent and not exposing any kind of destination that my NavigateTo action could use. @slimshader was trying to ask how he can use those actions and assets with the MC.

    I've done all my AI work with NavigateTo and ActivateMotion, but I can understand that people may want to use these as they provide out-of-the-box functionality.

    Right now, the MC wants control. A custom motion that reads the NMA and overwrites input is my quick answer. But, there may be a better one. I need to think about it more once I get past S&S.
     
    hopeful, recon0303 and TeagansDad like this.
  36. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    lol I actually went to school and knew the real one... No joke, from Michigan here .. he was a nice guy back then. until he quit. Marshall was a cool guy when he was young man.
     
    TeagansDad and Tryz like this.
  37. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Yeah, I'm not a fan of rap/hip-hop in general, but I'm familiar with the song (metal is more my style).

    Back on topic... ;)

    @Tryz, how would you suggest adding analog stick support to movement? Would you make changes to the motions themselves, or would you have the Input Source handle that?
     
  38. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    same here. cant stand rap.


    I personally have the input source handle it.
     
  39. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The input source.

    The UnityInputSource.cs is a good example. When you check the "Use Xbox" checkbox, I add some entries to the Unity Input Manager.

    Then, the MovementX and MovementY properties use those values. In turn, the MC and motions use MovementX and MovementY.

    So, if you wanted to change the analog stick or if it's something other than the Xbox settings, you would do it in MovementX and MovementY and everything would just work.

    I think that's what you're asking. :)
     
    recon0303 likes this.
  40. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Yes, that's exactly what I'm asking. :)

    I'm just using a standard Xbox 360 wired controller. When I enable the OOTII_PROFILE on the MC, I see that the left analog stick's input values are getting clamped to 0.5 unless the Run button is held down. The UnityInputSource looks like it's just getting the float value for that particular axis.

    What am I missing here?
     
  41. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    In the WalkRunX motions (say Walk Run Pivot), check the "Default to Run" check box.

    In the animator, I use the following standard across WalkRunX motions:
    0 = idle
    0.5 = walk
    1.0 = run

    So, the motions modify the values before sending the data to the animator. This helped me use the blend trees as the value transitions between idle, walk, and run.
     
    recon0303 and TeagansDad like this.
  42. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    That's the missing piece. Now that you say it, this sounds vaguely familiar. If it's in the docs then I clearly missed it. ;)

    Thanks!
     
    recon0303, kurotatsu and Tryz like this.
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I just wanted to share a quick update on where I am with the Sword & Shield Motion Pack:



    Still lots to do, but you can see it coming together.
     
  44. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    Looking sharp.
     
    Tryz likes this.
  45. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Looks pretty fantastic to me. Really looking forward to this one; I figure that it should give me enough of a base to build other melee weapon motions as well.
     
    kurotatsu and hopeful like this.
  46. DanielKW

    DanielKW

    Joined:
    Nov 11, 2014
    Posts:
    38
    Hey everyone, new to ootii's great stuff. He Recommended I come here to ask.

    Have any of you guys used his controller with UMA, and if you have any ideas how to get it working nicely together, for example I'm creating my uma at runtime and it's having problems. thanks in advance guys.
     
  47. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    I don't have recent experience with UMA and MC, but I believe things are supposed to be better if you use the UMA53 branch from Github, which is the most recent version. It's not feature complete, so it hasn't replaced UMA 2 on the asset store yet, but it's stable.

    Someone else can probably give you the complete lowdown and nitty gritty on how to get it working with MC and the AC. ;)
     
    Tryz likes this.
  48. DanielKW

    DanielKW

    Joined:
    Nov 11, 2014
    Posts:
    38
    Thanks hopful I'll have a look at it. If anyone else can help I'll gladly hear it. Cheers :)
     
    Tryz likes this.
  49. antoripa

    antoripa

    Joined:
    Oct 19, 2015
    Posts:
    1,163
    Hi guys ...
    few posts ago we discussed about Behavior Design and Motion Controller.

    So please take a look ..


    and


    Still work in progress but as soon as all is fully tested I will share with everyone
     
    hopeful, TeagansDad and Tryz like this.
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Very very awesome! Thank you. :D