Search Unity

Motion Controller

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

  1. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Yep. Thanks for the tip.
     
    Tryz likes this.
  2. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I don't have time to make a video right now, but I'm seeing an issue with running jump in an indoor scene. About 4 out of 5 times the character just plays the animation, but doesn't actually jump. About every 5th time it does the actual jump. This is just on a completely flat surface with just a box collider. I thought it might have to do with the AI Warrior player integration, but I disabled the 2 extra components (Capsule Collider and Player_Main), but it still happens.

    [EDIT]
    Very interesting that I just tried the same scene on the Wii U and it works perfectly fine there every time. I'm only seeing it in the editor, which is using alternate input, of course. Strange.
     
    Last edited: May 11, 2017
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Are you running the latest version of the MC?

    There was a bug I fixed that did something similar when the surface was thin and the bottom of the platform was taken into account.
     
  4. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm almost certain I am, but I'll double check when I get home. It's odd that I don't see the issue on the Wii U, but just when running in the editor.
     
  5. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    So are you good now with AIW? One thing I neglected to mention earlier - the AIW demos use two enemy types: one that uses a ragdoll, and the other (the "Bruiser" boss) that doesn't. I wasn't really happy with how the ragdoll versions worked. I could sometimes damage enemies enough to leave them in the ragdoll state without actually killing them. So they'd lie there, still showing 30% on their health bar, but unable to get up. When damaged, they'd also sometimes go flying again after getting up, without me even hitting them. If you have more patience and experience with combat systems than me, maybe you can tweak some of the damage, hit reactions, and ragdoll settings, but I prefer to just not use the ragdoll based enemies.

    When you have time, you might want to check out the healing potions, and Jedi-like "Gathering" feature, that lets you pull collectable items within a given range toward your player. Also check out the Radar, which, besides enemies, can be set to show other objects of interest in the scene. :)

    Right. I wasn't a huge fan of the Pommel Bash either. You see this move in movies all the time, and it can be quite effective in certain situations, but less so when using random attacks during a fight. I'd be saying "Time to finish him off with a jumping spinning slash", and I'd get a series of pommel bashes instead, while my enemy was cutting me to ribbons. Not cool. I took it out too. :rolleyes:
     
    Last edited: May 11, 2017
    magique and TeagansDad like this.
  6. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I have one other issue right now. I attached the trail renderer to the Ootii sword and also added the Tip transform and assigned the correct sword object and Tip to the weapon trail script, but it doesn't activate when attacking. Any ideas how to make that part work?

    I had issues with ragdoll too and just disabled it. I don't really need it anyway. One issue I saw was once the player character got somehow attached to the dead ragdoll and it was being dragged around the scene. The player would sometimes get a few feet away and then be rubber-banded back to the dead ragdoll.

    Definitely will do that. Thanks for the tips.
     
  7. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    Sorry, no. I've never actually used that feature. I'll take a look though, and see if I can learn more about it. :oops:
    Exactly. I actually prefer the FBX based knock-back and death animations anyway most of the time, so no big loss for me.
     
    TeagansDad and magique like this.
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The issue was actually in the ActorController when the FixedUpdate ran twice without an Update. It would basically erase the jump force. So, the character would animate with the jump, but no go up.
     
  9. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    I had no luck using the Trail prefab that came with AIW. The WeaponTrail_AI_Warrior script it uses is apparently based on a script posted on the Unity Scripts Wiki, but seems to have been modified, and it wasn't too clear to me how it was supposed to work. Instead, I just added a tip child object to the sword prefab I was using with AIW, added the standard Unity Trail Renderer to it, selected a particle material, and tweaked the time values a bit. This is what I ended up with:

    Weapon_Trails_1.jpg

    The only problem is that it's on whenever the sword is active, which gets annoying really fast when you're just walking with the sword in your hand. What's needed is a script that only turns it on when you use an attack motion, which should be pretty simple: only activate the tip object when you press the "Attack" button. ;)
     
  10. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Yeah, I can get the AIW trail renderer to work the same way. You just turn on the Emit flag and it's always on, but that's not how it's supposed to work of course. I'll have to dig into the code. I think there must be something that ties the attacks to turning it on/off and there's no hook in there for MC. I've done this sort of thing before and with my own code and I did it by adding Animation triggers which called a function to turn it on/off at certain parts in the animation. I'll see how AIW is doing it though and see if I can adapt it. Thanks for trying though.
     
  11. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    Hi Again, Everyone

    Is it possible to have the Camera Rig dynamically find a player in a scene? I'm trying to figure out how to get my inventory pro and ootii assets to stay connected through scene changes. This should be relatively simple except we use different camera rigs for different scenes while the character persists throughout.

    On Motion Controller you have the feature to dynamically find an Input Source and Camera Rig. I was hoping you could tell me if there's a way to have the camera perform the same function?

    Thanks in advance,

    Nathan
     
  12. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    I use a persistent player, and need to find and be found by various assets when I change scenes. While I take a persistent Input Source and Camera Rig with me, I sometimes need to attach things like local AQUAS lens effects to my camera, that work with the bodies of water in each scene. I also sometimes detach the camera, and attach it to a different camera rig - when I'm using a vehicle for instance. I usually just tag the player as "Player", the camera as "MainCamera", and the camera rig as "CamRig". Then I can find them all by their tags when I load a new scene, or at any other time that I need to access them.

    Are you talking about swapping the entire camera rig, or just the camera itself? If it's just the camera, it's a simple matter of finding and parenting a new camera to the rig when you load the scene. If you're changing the whole rig, you'll need to assign values for the Camera Rig field in Motion Controller, and the Anchor field on the Camera Rig (if you're using one of Oottii's rigs). That's a bit trickier, as you need to reference those fields in the applicable scripts, but it's still do-able. If that's what you need, I'll leave it to Tim to tell you the best way, rather than risk botching the explanation though. :eek:

    Another approach is to just adjust camera and rig parameters as needed, rather than replacing the camera or rig when you load each scene. If you use the new Post-Processing Stack in Unity 5.6 for instance, it's dead easy to swap out camera processing profiles (basically camera effects prefabs) to give each scene its own distinct look. And if you use Ootii's Camera Controller, you can set up and easily select different camera motors for different situations. Worth a thought if you're not locked into your current system.
     
    Last edited: May 12, 2017
  13. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @FargleBargle I forgot, but I'm still having the issue with the Eyesight Camera in AIW. I have to deactivate them or the scene renders through one of the enemy's eyesight cameras instead of the MC camera rig. How do you solve that?
     
  14. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Very strange, but even when I remove this, the player still performs that Pommel Bash every once in a while.
     
  15. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    Check that the eyesight camera is un-tagged and set the Depth to -1, with the player camera tagged as "MainCamera" at a Depth of 0. If that isn't it, I'm stumped. I've never seen that issue, and never had to touch the eyesight camera settings, but here they are just in case:

    EyesightCam.JPG
     
    Last edited: May 12, 2017
  16. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I thought I had checked this before, but the MainCamera was at the same depth of -1 so I changed to 0 and that worked.

    [EDIT]
    Actually, I realized that the eyesight camera is a huge design flaw. It essentially renders the scene again for every AI in it. That's a major performance problem. I'm leaving them disabled. If it needs some code to determine player visibility then there are much more performance friendly ways to do it.

    [EDIT 2]
    Now I'm wondering if the eyesight camera might be usable with a few tweaks. I'm not sure what AIW does behind the scenes, but if the FOV and far clip plane were adjusted and the culling layer was set to just the Player layer then it might actually perform better and work as intended. I might give that a try before looking for an alternate solution.
     
    Last edited: May 12, 2017
    FargleBargle likes this.
  17. Sarun_Ratta

    Sarun_Ratta

    Joined:
    Mar 26, 2015
    Posts:
    8
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Yes. You just have to determine when to enable Final IK and how it works. The animations I'm managing are all standard Mecanim animations. So, the Final IK should just work with those.

    Yes. You'll just have to make sure you create an InControl Input Source.

    Input Sources are what allows all my assets to work with any input solution. Here's a video that discusses that.
     
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    How are you activating the attack?

    It must be another attack style then. If Pommel Bash isn't in the Attack Styles, it simply can't be used because that's where the Parameter ID, Field of Attack, and other properties are defined. Without the entry being in Attack Styles, those properties just don't exist and the attack wouldn't know what to do.
     
  20. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm just using the attack button and every so many attacks it occurs. If it's not the pommel bash then I don't know what it could be. All those other attack names seem to describe the normal attacks quite well. I'll take a closer look later and let you know.
     
    Tryz likes this.
  21. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    Hello.

    I have just bought the Easy input asset and i am trying to figure out how to call it from within my motion code. In the documentation it states that it is a static class but i am unable to find it.

    Does anyone know how to check for one of your "Action Aliases" defined by Easy Input source?
     
  22. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    I may just have to put my motions for Kubold's sets out there as-is for people to build on or use as a guide for building their own. It's just too time-consuming to get them polished and easy to set up from the "Packs" tab. They're probably 90% of the way there, but oh man that last 10%...

    With the additional animator layers (and corresponding parameters) that I've added, I'm no longer able to easily generate all of the animator states (as some aren't directly associated with motions).

    And at this point, working on them is actively hindering my work on my own game, as sometimes borrowing an animation from one of the other packs helps with creating something like a hit reaction, but I'm trying to keep them modular.

    For the purpose of sharing motions, it makes sense to neatly package them up by which animation asset they use, but I'm starting to find that this approach is creating extra work for me in the long run, as I'll end up building different ones for myself where I can be more free with mixing animations from different sets. Not to mention integrating other 3rd party assets with tbe motions.
     
    Tryz, hopeful and christougher like this.
  23. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,685
    Whatever you can share ought to be fine. And I totally understand about wanting to customize things for your game by using an animation from this set in conjunction with one from another. Many (or all) of us would be doing the same thing in our own projects.

    I know I'll be using a mix of animations from many sources, including some Kubold and some Mixamo.
     
    Tryz likes this.
  24. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    I recently picked up Easy Input too. Most of the information you want is in the User Guide. First, you need to create a game object containing the Easy Input Source script, or replace the existing Input Source script used by Motion Controller, if you use it as well. Once you've done that, here are a few other things to keep in mind:
    • Hitting the "Reset Input Entries" button in the Easy Input Source, as instructed in the Quick Setup at the beginning of the guide, can potentially mess up existing inputs. It reset some of my custom InputManager entries to their default values. Fortunately I had backups, so was able to retrieve the lost settings, but remember to back up the InputManager.asset file (in the ProjectSettings folder of your project) before proceeding.
    • Easy Input seems to only manage aliases that have been added to its Input Source. Any corresponding Unity InputManager entries need to be removed first, or they may still be active after setting up actions using the same aliases in Easy Input.
    • When calling InputManager from another (C#) script, you need to include a "using com.ootii.Input;" statement at the beginning of the script.
    • Once you've done that, Easy Input can be accessed from your script using "InputManager.<command>" See the User Guide for specific command examples.
    I hope that helps. :)
     
    Last edited: May 14, 2017
    Tryz and hopeful like this.
  25. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Fargle already answered, but I figured this may help too:

    1. Add an Easy Input Source to your scene (replacing the Unity Input Source)


    2. Use this with the Motion Controller


    3. Now all the motions will automatically use the Easy Input Source. In your code, you would copy what I do in all the motions. Something like this:

    Code (CSharp):
    1. if (mMotionController._InputSource.IsJustPressed(_ActionAlias))
    2. {
    3.     // Jump
    4. }
     
  26. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    Hi @FargleBargle

    Thanks for the detailed response again!

    You've given me some great insight on how to approach this. Sorry for the delay in responding, I've been away from my computer for a few days and I won't get to try any of this out until tomorrow or the day after.

    I am using Camera Controller and I don't know why I didn't think of simply enabling a different motor. Probably because I set up the main camera while someone else set up the other one. I will probably try this and see how it goes. I'm currently rolling my eyes as I wonder why I didn't think of this.

    Once again, thanks for your time and insight. I'll let you know how it goes.

    Nathan
     
    Tryz and FargleBargle like this.
  27. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304

    Also, when you say that you detach a camera and reattach it to a different Camera Rig, you mind providing a little insight as to how you do this? I looked in the manual but couldn't find anything like this. I'll eventually be needing to do something similar and I hadn't even anticipated this yet.

    With the Aquas scripts aren't they just enabled and disabled automatically by entering and exiting the water, or am I completely missing another factor in the ol' consumed resources pile?

    Thanks again.

    Nathan
     
  28. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    The simplest way is something like this:

    Code (CSharp):
    1. public GameObject cam; // Main Camera
    2. public GameObject camRig; // Camera Rig
    3.  
    4. void ParentCam (){
    5.  
    6.     cam.transform.position = camRig.transform.position; // Move camera to camrig
    7.     cam.transform.rotation = camRig.transform.rotation; //Rotate camera to match camrig
    8.     cam.transform.parent = camRig.transform; // Parent camera to camrig
    9. }

    As indicated earlier, you can make the public "cam" and "camRig" variables private, and find these objects using tags when you start each level, if they're persistent objects that aren't present in each scene.
    Yes, as long as they're included in the list of Water Planes in the Game Objects section of the AQUAS_Lens_Effects script. Since these are Game Objects though, they must be present in the current scene to be enumerated, so water planes in other scenes are all missing. To solve this, I just set up AQUAS Lens Effects game objects in each scene. When I change scenes, I first detach the old effects GO, and then grab and attach the new effects GO to my camera after loading the new scene. This uses a similar method as parenting cameras above.
     
    Last edited: May 15, 2017
    Tryz likes this.
  29. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Is there a specific video tutorial or guide that gets into the details of replacing animations? I want to replace a lot of the animations with Sword & Shield Animset Pro. I've replaced animations before, but I have to admit getting lost in the vast array of animation states and not being able to find what I'm looking for. And I think there's more to it than just replacing the animation file for MC unless I'm mistaken.
     
  30. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @TeagansDad Sent you a PM about your Sword & Shield Animset Pro integration.
     
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    If your animations line up with mine, then replacing them is a simple drag and drop.

    If your animations don't line up... say I start walking on the left foot and your animations start on the right... then you will probably need to adjust transitions as well.

    I don't have a tutorial as this is just standard Unity mecanim work. Unity does have some mecanim videos that talk about transitions, animator states, etc.
     
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    As I would expect, but I'm having a hard time finding where the animations are. I looked for quite a while and couldn't find the Sword attack animations anywhere in the Animator. Any guidance on where to find them?
     
  33. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Sure. They are in the PSS_BasicAttacks-SM sub-state machine in the animator.

    I typically match the motion name (PSS_BasicAttacks) with the sub-state machine (PSS_BasicAttacks-SM).

    I talk about this a bit in the user guide as well (page 37)... but I know there's a lot to consume.
    http://www.ootii.com/Unity/MotionControllerPacks/SwordShield/SwordShieldUsersGuide.pdf
     
  34. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I remember somewhere in this thread we talked about the delay between attacks, but I can't find the information now. I'm going to speed up the attack animations by about 1.25-1.5 and also reduce the delay between attacks to almost zero. But I can't remember how to reduce that delay between attacks.

    [EDIT]
    Is the method to do this through the Chaining Attacks method as described in the manual?
     
    Last edited: May 15, 2017
  35. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    304
    Amazing! Thank you so much @FargleBargle

    I had not thought about that for Aqua yet because we're only just starting the second level and hadn't reached that point yet.

    This forum is so great.

    Nathan
     
    Tryz likes this.
  36. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Yeah, you can tweak this by where you place the BeginChain and EndChain animation events, as well as the transitions between attack states. It's easier to do if you're using animations designed to be used in such a way.

    I tightened up the attacks in my SSAP pack quite a bit... Try them out and see if the timing is closer to your liking.
     
    Tryz likes this.
  37. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I don't manage any delay between the attacks. Any delay that exist comes from the animator transition that occurs after the attack animation. From my perspective, the attack can happen as soon as the animation is done. By shortening the transitions, attacks can happen faster. However, it also means the animations can 'pop' more. The animations by Kubold are much cleaner.

    I think that any cool-down delay would actually be part of the GUI. This would prevent special attacks from happening more often.

    Timing for chaining does come from the animation events as @TeagansDad mentioned.
     
  38. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I investigated the Pommel Bash issue and there is definitely a problem. Here is a screenshot of my Basic Attacks so you can see that Pommel bash is not in there:

    upload_2017-5-16_7-10-58.png

    However, I had my player selected and the Animator window open while playing the game. I clearly saw the Pommel Bash animation playing on some of the attacks.
     
    Tryz likes this.
  39. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    Confirmed. Not sure how to completely disable it, other than to remove it from the State Machine. Not sure how the PSS_BasicAttacks script would react to that though, if the attack was still being called by the script. You might need to remove references from there as well. But since this doesn't seem to be the intended behavior, maybe we should wait and see what Tim suggests before trying anything like that. :eek:
     
    Tryz and magique like this.
  40. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Thanks. I'll dig into this when I get home.

    Contract job is nearing its end. Needless to say, things are crazy. I'll check on it tonight. :)
     
    TeagansDad likes this.
  41. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Thanks.
     
  42. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @FargleBargle I figured out how to do the weapon trail effect using AIW. If anyone else is integrating with AIW with MC then this should be useful as well. In AIW there is a script called PlayerAtkBehaviour. This is a State Machine Behaviour, which I admit I didn't even such a thing know existed. All you have to do is go to the various sword attack animation states and click on the Add Behaviour button and select PlayerAtkBehaviour. Of course, you have to have already prepared your sword with the AIW weapon trail script and enabled useWeaponTrail in your Player_main script. here is a link explaining State Machine Behaviours:

    https://unity3d.com/learn/tutorials/modules/beginner/5-pre-order-beta/state-machine-behaviours
     
    FargleBargle and Tryz like this.
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I see what's going on.

    Even with Pommel Bash gone, the animator's parameter value is still there. I'm not sending a style value to the animator just the random index. So, I'm playing the Pommel Bash animation and using the style information associated with the index (which is not Pommel Bash).

    I'll fix this for the next update.
     
  44. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Spell Casting Motion Pack Update

    The pack is done. I just need to put together a demo scene and marketing info. Then, I'll submit it.

    I've been underwater lately (bad for the SCMP, but good for my bank account ;)). So, I'll get this done as soon as I can.

    In the mean time, take a look at the docs and let me know what you think.

    User's Guide:
    http://www.ootii.com/Unity/MotionControllerPacks/SpellCasting/SpellCasting_UserGuide.pdf

    Builder's Guide:
    http://www.ootii.com/Unity/MotionControllerPacks/SpellCasting/SpellCasting_BuildersGuide.pdf
     
  45. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Thanks.

    I have another question. When rotating the camera around the character, I notice that it is frame rate dependent. Is that by design? Because sometimes I'm working on a scene that isn't optimized yet and because I'm getting lower frame rates, my camera rotates super slow. I would think that regardless of my frame rate I should still be able to rotate the camera quickly.
     
  46. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    It should be frame rate independent.

    I use a "frame rate limiter" to force 10 fps, 30 fps, 120 fps, etc. This is what I used to test my independence with. I noticed with Unity 5.6 that the limiter had an issue. So, maybe my rotation velocity approach needs to change as well for some reason.

    I'll re-look at it as soon as I can. I'm assuming you're using the Camera Controller's 3rd Person motors?
     
  47. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Yes.
     
  48. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    @magique: Thanks for the tip on enabling sword trails. The SM Behavior function is exactly what's needed to turn the effect on and off, and seems to have lots of other potential uses as well. And good catch on the Pommel Bash. In retrospect, I'm sure I'd seen it happening a few times as well, even after I disabled it, but hadn't followed up yet. :oops:
     
  49. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Actually, that PlayerAtkBehaviour is doing lots of unneeded stuff as well. I have not idea why, but there is all kinds of damage code in there as well that's not needed. Probably best to just make a new state machine behaviour and just copy into it the trail render stuff.
     
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I'm doing some testing and not seeing much of a difference. Here's a video to show you what I see. You can see that I change the frame rate from 10 FPS to 1000 FPS. The mouse speed and range is pretty consistent along with the camera rotation.



    I've tried it with some different smoothing values and that has a small effect, but it seems pretty minor in my tests. If you set smoothing on the motor to 0, does that help?

    What motor and settings are you using?