Search Unity

Motion Controller

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

  1. moria15

    moria15

    Joined:
    Feb 25, 2011
    Posts:
    395
    DO you have an almost empty scene with the FPS above 200? if so, thats an issue as the animation gets killed before it starts.. I had this one too.. set your scene to force the V-synch so you do not exceed 60 FPS and try it then.. you will probably find its fine at that point.

    I'm using UNET and UMA 2.7 as well and had that issue in my test scenes.

    M
     
    Last edited: Feb 28, 2018
  2. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    Maybe, are you referring to he V-Sync Count setting under Edit->Project Settings->Quality? I have set that to "Every V Blank" but no difference. Is there a different V-Sync setting? I think there is some disconnect between the Motions/Animations and Input Mapping. I can jump just fine from a stand-still, but cannot run & jump despite having checked that option in the Ootii component.
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Totally understand. If you want to send tim@ootii.com some screenshots of the character setup, maybe that will show me something.

    Please include your Unity Order ID.

    Thanks :D
     
  4. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    I'm making progress, will try not to bother you with screenshots, but I have noticed some of my controller issues are due to a rigidbody being created at runtime with a mass of 67.8 and gravity turned on. This causes my character to not be able to walk up ramps. When I turn gravity off on the rigidbody it walks up ramps just fine. Is there a setting to control how the rigidbody is set up?
     
  5. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    The Rigidbody should be set to Is Kinematic and with Gravity turned off, as the Rigidbody isn't being used to move the character.
     
    Tryz likes this.
  6. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    Right, tried that, now character won't ground after jump. I'm in that zone where changing a setting to make something work breaks something else. Honestly, I may try a fresh project at this point because several things just don't add up. I imported an example from another asset purchase and it whacked out some of my project settings - which is how I got a gravity value of -200 and spent half a day trying to figure out why I couldn't jump. So before I post anymore problems, I think I am going to try from the ground up in a fresh project.
     
  7. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    I have lost count of how many times I've started a fresh project and then imported everything piece by piece until I found out what was responsible for breaking things. :) It's often the fastest way to go about it, honestly -- at least if you don't have several GB of art assets in the project, which is why it's a good idea to get all of your core gameplay systems working fairly solidly before you go wild with importing environment and character packages. ;)

    Also, one should ALWAYS review the list of files when importing an asset package. No exceptions. :) Unity tracks project files by the GUID assigned to them (which can be found in the associated .meta file) and not by folder name (or even file name). So you can end up having an asset package overwrite files in folders belonging to other assets if both incorporate some of the same files (say copied over from a Standard Assets, Post Processing Stack, etc). Duplicating a file (CTRL-D) gives the duplicate file a new GUID, so even if you move it to another folder and get rid of the " (1)" after the file name, Unity will treat it as a completely different file.
    I think I used every possible formatting option to emphasize "always." It's seriously that important.

    When a package includes Project Settings as part of the import, it's best to un-check all of them unless you're using that asset as the basis for your project. It's much better when the asset developer provides Editor functions for configuring the project settings, rather than just including the files that you're supposed to overwrite yours with. In lieu of that, just import that asset into its own empty project to look at its Project Settings and then manually make any necessary changes to yours.

    Anyway, when you're using Motion Controller, the Rigidbody's "gravity" is not used to ground the character when falling or jumping. You need a Kinematic Rigidbody on the character in order to apply forces to other Rigidbodies (non-kinematic) and also in order for triggers to detect collisions with your character.
     
  8. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    Thanks for the good advice. I'm a bit careless when experimenting with new assets. On the rigidbody thing, if it is supposed to be kinematic why is it being created without that option checked? When I check kinematic, character goes up ramps no problem but won't ground after jump. When I uncheck it the character jumps and grounds properly, but won't go up a ramp.
     
  9. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    With is kinematic checked I can jump, then change the skin width setting to make the character ground. But at that skin width setting the character won't jump again until I set skin width back to its original setting. Is there a formula for these settings? Like at this height, mass, radius, set up physics, grounding, and colliders like so...??
     
  10. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    Ok, so tweaking the skin width settings I have my character jumping, landing, and walking up ramps with is kinematic set to true. BUT, how do I tell whatever is creating the rigidbody component to set Is Kinematic to true upon instantiation? I can do it an initialization script, but that's just a hack. Should be a clean way to do this.
     
  11. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    The Rigidbody component by default enables the object to be controlled by the physics engine, as well as to respond to other objects controlled by the physics engine. Some character controllers use a Rigidbody to move the character (Invector TPC, Opsive TPC -- version 1; the upcoming version 2 will not).

    Because we want to use scripting and animation to control the character's movement, we need to set Is Kinematic so that the physics engine doesn't interfere with Motion Controller.

    You're testing the jumping in the fresh, brand-new project that you're talking about, right? ;)

    This is how I set up the Rigidbody on my player character:



    And my Actor Controller:



    Grounding Layers are: Default, Climb, Scalable Wall, Scalable Ledge, and Balance
    Collision Layers are: Default, Climb, Ladder, Scalable Wall, Scalable Ledge, Balance, and NPC

    Most of the Actor Controller settings haven't been changed from the default.
     
  12. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    Add the Rigidbody component yourself (in the Editor); then you can set up whatever properties you want on it.

    You shouldn't need to mess with the skin width settings. What asset are you using that is adding the Rigidbody for you?
     
  13. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    I don't know what is creating the rigidbody, but I will try to create it myself and see what happens. I have UMA DCS and UNET stuff and an animator on the character prefab as well as my own script for handling network instancing. But that's it. The rest is Ootii's stuff. I am using easy input, camera controller, on their own gameobjects. I think my setup is pretty straight other than the UMA and UNET stuff, but even those appear to be working nicely with the motion controller. BTW, thank you for sharing so much great information!
     
  14. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    Creating my own rigidbody solves the problem!! Okay, now to try to cast a spell! :)
     
    Tryz and hopeful like this.
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    @Awesumo It looks like @TeagansDad came to the rescue again. I'm glad you're moving forward.

    One comment I'd make is that there's nothing in my components that automatically creates a rigidbody. I don't require or even expect it.

    If there's one being created, it must be from some other asset. If it's still being created automatically, you may want to check your other assets too.
     
    hopeful likes this.
  16. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    Ok, making more progress, but Running Jump will only fire if I let up on the W key while continuing to hold shift and hit the spacebar. Is there a special action alias for three-key actions?
     
  17. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    Got spell casting to work, but the animation from Miximo goes into slow motion for the last few frames then the animator is stuck in that pose. Demo scene does this too. Is there some animation setting that needs to be applied besides humanoid? An end event maybe?

    I am reading the docs as I attempt to do things. Everything is pretty clear, but finding a lot of stuff just doesn't work for me. Do you test from within the hierarchy or do you setup player prefabs? Most things are working, but there are just odd issues like having to lift up on W to fire a running jump. I have to wonder if some things are getting disconnected due to spawning.
     
  18. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    @Awesumo - I'd suggest that you create a new project and spend some time building the features you want without any networking or multiplayer code present. It's nearly impossible to tell where there problems are coming from if you don't already have a fair bit of knowledge and experience with each asset you're using. And networking always amps up the complexity level rather quickly.

    For a real-time game with a direct control scheme (as opposed to an indirect "click and watch your character pathfind like Diablo, Baldur's Gate, etc), the character controller is likely THE single most important component in the entire game system.

    So start with just the ootii suite of products and don't add others (Inventory Pro, Dialogue System, etc) to the mix until you're feeling confident that you've got a solid understanding of how this core of your game works (at least from a high level perspective).

    Some 3rd party assets are generally easy to integrate and don't intrude on the rest of your game systems (Dialogue System is a great example), while others are going to force your design to accommodate them (Inventory Pro is like this, to a degree). And obviously networking requires you to ensure that every game system can sync its state across the network, so it intrudes everywhere. If this is your first project (or first project of significant size/complexity), I would strongly suggest dumping networking/multiplayer and saving that for a later project. It can introduce severe headaches even when you're intimately familiar with all of your other game systems.

    Er, anyway, off of my soapbox... At the very least, keep a separate project where you implement the features you want with just the ootii suite (animation packs and character models are fine; they don't mess with anything). I've got everything working with UMA, but that does add another complex system, so maybe just use Fuse characters for this stage; other than positioning weapons on the character, pretty much everything else transfers over directly.

    Actually, it's also a good idea to keep a "clean" project consisting of just the ootii assets (don't make any functional changes other than setting up inputs and the like). It's very useful as a "sanity check" so you can test if something is broken in the asset (rarely) or if it must be in your scene, project settings, custom scripts, etc (almost always).
     
    Tryz and hopeful like this.
  19. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    Great minds think alike. :) I already built an Ootii-only project to learn and test the assets. Thanks again for the good advice. The reason I am struggling along with UMA and UNET is I am looking for a controller solution that integrates easily with those packages/features. I am trying others as well - Opsive has already failed miserably on the multiuser requirement but has really strong extendibility - will be cool to see what the next version looks like. I am certain Ootii's stuff runs great on its own, but I need to learn how to drive a custom character over UNET (also did testing with photon as well).

    So far Ootii's motion controller works well with UMA and UNET, the camera controller in particular is stellar. The problems I am having are due to my own lack of understanding the configuration necessary to make Ootii's stuff work - and the docs aren't helping much. On the flip side, basic motion controller and camera stuff is working better than other assets I've tried.

    So far here are my roadblocks:

    1. Can't seem to jump while holding shift, W and pressing space. It jumps when I hold shift and space and let up on W. In code this is a simple fix, but configuring I either have to post here and hope for help or I have to experiment until I figure it out - maybe never.

    2. Changing animations appears to be a complete chore. Why can't I just drop in my own "idle" for example. Tried following the advice in the doc and creating a new idle state but that ended up not really working and it's not the type of thing that should take hours to make happen. I see motions for basic idle, idle, random idle, etc. Why can't I just use a random idle motion and drop in my own idle animations? The animator controller appears to be a nightmare to customize, and I see why - because it is designed to be generic. So not knocking the asset at all, but not sure I want to learn someone else's spider web when all I need is input->fire animation sequence->update attributes kind of functionality. Really weighing the flexibility of generic code versus the results of purpose-driven (custom) code.

    3. The easy input thing is a mystery. Needed an alias for casting, but don't for walking. Why? When I click setup on the spellcasting pack shouldn't it set all this up automagically?

    4. The spellcasting system looks awesome, but the demos aren't working due to some issue with the miximo animations not properly ending and transitioning back to idle. Since the demos don't work I can't tell if any of the stuff actually works. I can't cast a spell in my own project or in the Ootii-only demo project probably because of some import/export issue with the miximo animations. I followed the instructions to the letter, but when I cast a spell the animation just freezes at the end and I see no particles or effects at all. Demo scenes should work out of the box in my humble opinion.

    5. Got the controller to play the casting animation, but no spell is instantiated even though the spell system appears to be setup according to the docks.

    In the grand scheme of things, these are minor issues and I am sure easily solvable. I just need to keep at it. This isn't my first unity project at all, I mostly do industrial simulation and extended reality stuff with unity and I have been using unity since it became available to the public. Been programming since the 70s! My problem is I am too old for all this "easy" stuff! :)
     
  20. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    EDIT (see below): Miximo export framerate has to be set to 30 fps.
     
    Last edited: Mar 1, 2018
    Tryz likes this.
  21. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
  22. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    You're welcome! My apologies if some of my suggestions come across as assuming you're a newbie. :) I don't remember reading posts from you before, and there are a lot of beginners on the forums. ;)

    Hmm, and here I figured that would have been the best one for multiplayer. I don't care about MP myself, so I haven't exactly tried it out... Motion Controller has Opsive beat in terms of extendability, IMO. It makes far fewer assumptions about your game. However, the way v2 is shaping up, it could give MC a run for its money (sorry, Tim!).
    Does this happen in a clean project too? I've been using MC for two years and I've never encountered this.

    The "Basic" motions go a long way towards making this easy. You just need to add the animator states, use the same transition conditions as the ones already included, and specify a different L0MotionForm.

    Do you use any of Kubold's animations? I've got setups for a bunch of them... Even if you don't, I can send you my animator as an example.

    Motion Controller does have tighter coupling between the code and animations than other controllers. This makes it more work to set up, but also gives you more control over the end result. I can set up a new weapon animation set in Opsive in 5 minutes... But I can never seem to massage it to get the same end result.

    I agree with that... But unfortunately, since Tim can't distribute the Mixamo animations with his motion packs, there's this one major source of trouble. And it comes up reasonably often. However I am perfectly willing to send a set of working animations privately to those who are having trouble getting them to work. ;)
     
    Tryz likes this.
  23. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    @Awesumo - Actually I missed one rather sweet feature. It does take more work to set up your animator states compared to some other controllers... But once you've got it set up, you can click a couple of buttons to generate the code to programmatically re-create those animator states -- including all transitions (even from Any State).

    So once you've done the initial setup, you can recreate all of your states in a fresh, clean animator (or at least a fresh duplicate of the base "Humanoid" one provided by Tim) in a matter of seconds.
     
    Tryz likes this.
  24. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    The running jump thing does happen in a clean project using an Ootii demo. When checking the jump & running jump check box in the "basic" panel, I noted no running jump motion was added to the motions list so I added it myself. When I run the demo W+shift runs and pressing space bar does nothing unless I simultaneously lift up on the W key. I'm happy it works for others but it is not working for me. :-(

    I want to make this controller work because it really does appear to be solid - but not if super basic stuff doesn't work. After re-exporting the miximo animations at 60 fps they are worse than at 30 fps and they make my character fall through the floor when I cast a spell. So my options are spellcasting that hangs or spellcasting that drops my character through the floor. I am perfectly happy to assume it is all user error, but really?
     
  25. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    That is just plain weird. Maybe Tim has some ideas...

    Check your PM/Conversations.
     
  26. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Thanks for this. At some point Mixamo changed all their animations and I had to adjust. I need to put a comment in that video to use 30 vs. 60.

    Unfortunately YouTube has removed annotation. I added a quick note, but will look to do new videos.
     
    Last edited: Mar 1, 2018
  27. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    343
    Anyone finding that for the demos shift for running and F for interaction do nothing? (Unity 2017.3.1p1)
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    So far when people have reported this its because they didn't press the "Setup Input Entries" on the Motion Controller the first time they add it to a project.

    I describe that on page 2 of the User's Guide:
    http://www.ootii.com/Unity/MotionController/MC2Guide.pdf

    Can you check that and make sure you did it? There will then be entries in Unity's Input Manager for "Run" and "Interact".
     
    LukeDawn likes this.
  29. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    343
    Yep, my bad. That works fine now. noob error 101.
     
    hopeful and Tryz like this.
  30. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    343
    I like the way it's split up into drivers and controllers. As I am building a networked game, ALL characters are network-driven from the server which has no graphics or animations; so this will be interesting to see how it works.
     
    hopeful and Tryz like this.
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    I agree with @TeagansDad that it's really odd. I'm seeing the checkbox work and the run jump happens.

    Someone else did have something similar with 3 keys being pressed and it turned out it was the keyboard. It's called "ghosting" and it's based on how the hardware lays out keys and regions.
    https://support.steelseries.com/hc/...at-is-anti-ghosting-technology-on-a-keyboard-

    The only other thing I can think of is to make sure your Running Jump motion has a higher priority than Jump. But, there's really nothing tricky about it. If you want to send your project to tim@ootii.com, I can take a look.

    As you mentioned, the animations should be 30FPS. The documentation was right, but the video wasn't. I've added a note in the video, but I'll re-do the video.

    Going half way through the floor in a crouched position is typically a sign that the animations aren't set. If you changed the animation (from 60 to 30), then it's possible you're dealing with a new animation reference and we need to press the Spell Casting Motion Pack's "Setup Pack" button again. That will re-build the animator with your new animation files.

    Easy Input has some default entries that handle basic input for movement and viewing. I talk about the default ones on page 9. http://www.ootii.com/Unity/EasyInput/EasyInputReadMe.pdf

    But, you're right... I don't set them up automatically like I do for the Unity Input Manager.

    That's an update I'll look at doing.

    It really shouldn't be a chore. We really are just replacing the animation in Unity's animator state using drag and drop.

    For "idle", I do use it in a couple of places to help transitions, but it should be easy. Lets say you just want to replace the idle with your own animation. You'd do this for the motions you're using:

    1. Open the animator state machine
    2. Click the animator state representing the idle
    3. Drag-and-drop your new animation to the motion field


    Let's assume you're using Basic Walk Run Pivot, you'd do it here too:


    Note: When I use the word "pose" it means an animation with only one or two frames.

    Of course swapping animations can get more advanced if you want to change transition times and blending, but the reason I did it this way is that you're just using standard Unity mecanim work-flow and all its flexibility.

    Once you get how motions work for Basic Idle and Basic Walk Run Pivot, it's the same for Spell Casting, Shooting, Climbing, etc... just a bit more complex :)


    I understand the frustration and I wish I could give Mixamo's animations away inside the packs, but their EULA specifically forbids it. The last thing I want is to be sued by Adobe. :(

    The good news is the animations are free. We just need to import them per the documentation and it should work. All the assets have been out for a while and I test them regularly. So, baring a change by Mixamo (which they've done), we should be good.

    I am happy to help (when @TeagansDad doesn't beat me to it). I also realize I'm the developer and an expert and looking at things as a new user is a totally different perspective. I'm happy to adjust documentation, videos, and code to help.

    Always feel free to email tim@ootii.com too. I try to be responsive.
     
    Last edited: Mar 1, 2018
    Awesumo and TeagansDad like this.
  32. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Networking is an interesting beast and not something I have a lot of experience with. I know some people are creating peer-to-peer games with my assets, but it sounds like you're using an authoritative server.

    As you move forward, there may be learning on both sides. If you find there are features that can help smooth the integration, let me know and I'm happy to make changes where it makes sense.
     
    LukeDawn, Awesumo and hopeful like this.
  33. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    @Tryz, @TeagansDad,

    I really appreciate the support and help. I will keep learning and making progress. I do not plan to look any further for a controller solution, Ootii's wins for my game project based on features and support. The networking integration is a huge part of that decision. The experimental sync component that comes with motion controller actually does a better job than paid assets I have tried - probably because it is simple/clean and not trying to provide MMO-level networking features which I don't need anyway. I will have to expand it a bit to keep other things synced but it actually provides a good base for doing that work. Right now I have four customizable UMA2 players running around a dungeon in sync and smooth, next week will be attempting to get spell combat going between them. The most important feature of the motion controller for me is how it "feels". Other controllers always seemed a few chromosomes away from having that AAA feel - where it is actually pleasurable to just control the character, like the experience deltas between driving a Porsche vs a Volkswagen. To me, that is what makes Ootii's solution the best choice to continue developing a game experience around.

    Interesting suggestion about the keyboard not handling 3-key presses simultaneously. Running jump does work from an animation perspective, it's just the keystrokes that are funky. I will try a different keyboard. I am currently using a crappy one that came with my PC. Time to upgrade! :)
     
    FargleBargle and TeagansDad like this.
  34. Awesumo

    Awesumo

    Joined:
    Nov 6, 2011
    Posts:
    57
    Tryz, hopeful and TeagansDad like this.
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Wow. Ok. I promise that buying new hardware is not typically a prerequisite to using my assets! :D
     
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    That is amazingly awesome!

    I may have to use that as a quote somewhere... I'm not sure where, but I like it. :D
     
    TeagansDad likes this.
  37. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,602

    I have done Auth and Non , with Motion Controller, using Bolt for Android and non, works great, I had to make some of my own changes for it to work properly animation wise, but wasn't bad at all. Once you know what needs to be done. For non, Auth, I had a very small script. and worked great.
     
    Tryz and LukeDawn like this.
  38. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    343
    My current setup is Auth. Send inputs to server, which moves the actor on the server (just a capsule), and any changes to the server actor get broadcast to clients within range.

    From looking at ootii so far, it looks like I will need a version of the Motion Controller (which is actually an Actor Driver) that has no animations, but broadcasts motion/actions to the clients. Client actors are dumb manikins that show animation and movement - so need to be told what to show.

    Obviously, I'm not using HLAPI for this, but the unet half-way house of NetworkServerSimple and NetworkClient.
     
    rubble1 likes this.
  39. JUBA-C4

    JUBA-C4

    Joined:
    Aug 16, 2014
    Posts:
    12
    Hi that’s great did you tried it with motion packs?
    Like how to use the bow when you had to disable the motion controller and there is no event on basic ranged attack thanks. We just finished making the movement and it’s run smooth even with 200~250 ping i am using forge network and we had to use MessagePack for serialization I really recommend to check on it
     
    Last edited: Mar 1, 2018
  40. JUBA-C4

    JUBA-C4

    Joined:
    Aug 16, 2014
    Posts:
    12
    Hi I’m thinking of buying kubold animation like the rifle and pistol and the sword but I am afraid that I can’t integrate it with ootii and it will take me long time to fegure out if can send me your animators you well make my day so please ❤️
     
  41. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Hi.

    Unfortunately, the animators and work I did to get them organized and setup is part of the whole package. So, I'm not really comfortable zipping up and sending you all my animators.

    If you check out my videos, you'll see the features and how they work. Maybe these will help.


    Changing out animations is standard Unity animator work. Like anything else, the first time is a learning curve, but it gets much easier.
     
  42. JUBA-C4

    JUBA-C4

    Joined:
    Aug 16, 2014
    Posts:
    12
    Hi tim when i get a hit from the AI the character freeze until the attack stops is it should be only affects the upper body or something that makes me able to move
    Something like my aiming get harder and I see the affects of the animation damage on the upper body or something like that it’s happened in all motion packs I can’t do any thing when i get hit
    Thank you
     
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    I think I understand.

    The Basic Damaged motion runs on the main layer and makes the whole body animate. So, no movement when you're being damaged. That's by design.

    You can put the Basic Damaged motion on the second layer and it will only animate the upper body. Just remember to create the animator state machine on the second layer as I don't do that by default.



    I've tried it on an NPC and it works as expected. However, I haven't tried it on a PC and make him run.

    Give it a try and we'll go from there.
     
  44. moria15

    moria15

    Joined:
    Feb 25, 2011
    Posts:
    395
    Hey Tim :)

    I probably missed this in the docs, but I have a load of UI screens that pop-up in the game now. I realised today that clicking on the UI screens actually makes the combat weapons fire (same key) and as I was rudely beaten to death by the city guards I realised that I was still carrying my sword and shield and I had inavertantly cut the NPC in half whilst I was shopping (hey seriously.. she should have dodged) anyhoo just wondered if there was a simple way to stop the LMB being a strike key for sword and bow IF there is a menu screen open.

    I know I could change the attack key, but I would rather not :)

    M
     
  45. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    @moria15 - you just need to disable the Input Source used by the Motion Controller when your UI windows open.

    If you're using Inventory Pro and/or Dialogue System, I just so happen to already have scripts to do this. ;)

    I think I posted the Inv Pro one fairly recently. I'll repost it and the DS one later tonight (or tomorrow). If you're using a different conversation system, then see if there is an event that gets raised when the window opens or the dialogue starts.
     
    Tryz, hopeful and moria15 like this.
  46. moria15

    moria15

    Joined:
    Feb 25, 2011
    Posts:
    395
    Yep using Inv Pro right now.. not got to the Dialogue system yet. (It's on the list), and thank you :)
    M
     
    Tryz likes this.
  47. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    Here's the one for Inv Pro:

    Code (CSharp):
    1. using UnityEngine;
    2. using com.ootii.Actors.AnimationControllers;
    3. using com.ootii.Cameras;
    4. using com.ootii.Game;
    5. using Devdog.General;
    6. namespace CodexFramework.Integrations.Inventory_Pro
    7. {
    8.     [RequireComponent(typeof(MotionController))]
    9.     public class InventoryOotiiInputController : MonoBehaviour, IPlayerInputCallbacks
    10.     {
    11.         private MotionController mMotionController;
    12.      
    13.      
    14.         private void Start()
    15.         {
    16.             mMotionController = GetComponent<MotionController>();    
    17.         }
    18.         public void SetInputActive(bool rActive)
    19.         {
    20.             if (mMotionController == null) { return; }
    21.             Debug.Log("SetInputActive: " + rActive);
    22.             mMotionController.InputSource.IsEnabled = rActive;
    23. #if OOTII_CC
    24.             var cameraController = mMotionController.CameraRig as CameraController;
    25.             if (cameraController != null)
    26.             {            
    27.                 // Disable Targeting In motor so it doesn't engage when right clicking to equip the bow
    28.                 var targetingIn = cameraController.GetMotor("Targeting In");
    29.              
    30.                 if (targetingIn != null)
    31.                 {
    32.                     Debug.Log("Targeting In motor enabled: " + rActive);
    33.                     targetingIn.IsEnabled = rActive;
    34.                 }
    35.             }
    36. #endif
    37.             if (GameCore.Core != null)
    38.             {
    39.                 GameCore.Core.IsCursorVisible = !rActive;
    40.             }
    41.         }
    42.     }
    43. }
    44.  
    When looking back for it I noticed that you pointed out that my InvProAttributeSourceEditor inherits from an EditorBase that I didn't provide. I'll repost the script without that requirement.
     
    moria15, Tryz and hopeful like this.
  48. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    Here's the script to disable player control when Dialogue System starts a conversation:

    Code (CSharp):
    1. using com.ootii.Actors.AnimationControllers;
    2. using com.ootii.Game;
    3. using PixelCrushers.DialogueSystem;
    4. using UnityEngine;
    5.  
    6. namespace CodexFramework.Integrations.Dialogue_System
    7. {
    8.     [RequireComponent(typeof(MotionController))]
    9.     public class DialogueSystemMotionControllerBridge : MonoBehaviour
    10.     {
    11.         /// <summary>
    12.         /// (Optional) Normally, this component uses the game object's name, or "Player" for
    13.         /// the player, to match up with the name of the actor in your dialogue database. If your
    14.         /// actor is named differently in your dialogue database, set this property to the actor's name.
    15.         /// </summary>
    16.         [Tooltip("Use this name in the Actor table.")]
    17.         public string overrideActorName;
    18.  
    19.         [Tooltip("Disable player movement during conversations")]
    20.         public bool disablePlayerMovement = true;
    21.  
    22.         public bool isPlayer { get { return gameObject.CompareTag("Player"); } }
    23.      
    24.         protected MotionController _motionController;
    25.      
    26.         void Awake()
    27.         {
    28.             _motionController = GetComponent<MotionController>();
    29.         }
    30.  
    31.         void Start()
    32.         {
    33.             // Set actor name:
    34.             if (string.IsNullOrEmpty(overrideActorName))
    35.             {
    36.                 if (isPlayer && GetComponent<OverrideActorName>() == null)
    37.                 {
    38.                     overrideActorName = "Player";
    39.                 }
    40.                 else
    41.                 {
    42.                     overrideActorName = OverrideActorName.GetInternalName(transform);
    43.                 }
    44.             }
    45.         }
    46.  
    47.         public virtual void OnConversationStart(Transform actor)
    48.         {
    49.             if (disablePlayerMovement)
    50.             {
    51.                 //Debug.Log("Conversation Started; disabling player controls");
    52.                 DisablePlayerMovement();
    53.             }
    54.         }
    55.  
    56.         public virtual void OnConversationEnd(Transform actor)
    57.         {
    58.             if (disablePlayerMovement)
    59.             {
    60.                 //Debug.Log("Conversation Ended; enabling player controls");
    61.                 EnablePlayerMovement();
    62.             }
    63.         }
    64.  
    65.         public virtual void EnablePlayerMovement()
    66.         {
    67.             _motionController.InputSource.IsEnabled = true;
    68.             GameCore.Core.IsCursorVisible = false;
    69.         }
    70.  
    71.         public virtual void DisablePlayerMovement()
    72.         {
    73.             _motionController.InputSource.IsEnabled = false;
    74.             GameCore.Core.IsCursorVisible = true;
    75.         }      
    76.     }
    77. }
    78.  
    79.  
     
    jovino, moria15, Tryz and 1 other person like this.
  49. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    And here's the EditorBase script that my InventoryProAttributeSourceEditor inherits from (it just puts the dirty checking in a base class to eliminate some copy-and-paste when making editor scripts):

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. namespace CodexFramework
    5. {
    6.     public abstract class EditorBase : Editor
    7.     {
    8.         // Helps us keep track of when the list needs to be saved. This
    9.         // is important since some changes happen in scene.
    10.         protected bool mIsDirty;
    11.  
    12.      
    13.         /// <summary>
    14.         /// Call when handling the dirty state
    15.         /// </summary>
    16.         /// <param name="rTarget"></param>
    17.         /// <param name="rTargetSO"></param>
    18.         protected virtual void HandleDirtyState(Object rTarget, SerializedObject rTargetSO)
    19.         {
    20.             // Flag the object as needing to be saved
    21.             EditorUtility.SetDirty(rTarget);
    22.  
    23. #if UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
    24.             EditorApplication.MarkSceneDirty();
    25. #else
    26.             if (!EditorApplication.isPlaying)
    27.             {
    28.                 UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene());
    29.             }
    30. #endif
    31.             // Pushes the values back to the runtime so it has the changes
    32.             rTargetSO.ApplyModifiedProperties();
    33.  
    34.             mIsDirty = true;
    35.         }
    36.  
    37.  
    38.     }
    39.  
    40. }
    41.  
     
    moria15, Tryz and hopeful like this.
  50. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    343
    How much work is done by the MotionController through animations?
    I'm attempting to create a server version of the MotionController which doesn't have animations - basically the server has the ActorController which is just colliders, with a stripped back MotionController that does the movements (from network inputs) as if it was doing animations, but with no rig or animations present.

    The server is headless with no graphics, and doesn't need anything more than colliders.

    I've been looking through the MotionController, and just wanted to know if this is possible, going by all the references to the Animator state machine.