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
    I'm actually seeing the issue when run on the Wii U console, which uses joystick input. So, maybe that has something to do with it. I may have to look at it from that angle.
     
  2. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Good info. I just tried with the Xbox controller and it takes 4 seconds to do 360-degrees at both 10 FPS and 1000 FPS.

    I wouldn't think Wii U would matter. I'll see if I can load a scene up and test it with something besides my frame rate limiter too. Just in case.
     
  3. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Very interesting. I have no idea what the deal is then. The difference for mine is dramatic. In editor view I can rotate around in 2 seconds at 180 speed, but in a scene on Wii U which currently gets 16-20 FPS, it's taking like 7 seconds or more. It's just insane how slow it goes.
     
  4. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Would you email tim@ootii.com the motor and setup you're using? I'll duplicate it here. Maybe there's some places in code we can add some debug to see what the difference is between the Wii U and the PC.
     
  5. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'll do that when I get a chance. I'm not able to do it at the moment.
     
    Tryz likes this.
  6. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I e-mailed you the settings, but don't bother trying it. It appears the issue is with the InputManager settings for my Mouse X and Mouse Y. I've long ago had to set some pretty odd parameters for Gravity, Dead, and Sensitivity for the Wii U Gamepad, and that is somehow the cause of this. In fact, by setting both to 0, .2, .1 I get a strange issue where vertical becomes horizontal (and works smoothly by the way) and horizontal doesn't move at all. So, I need to re-figure out what are correct settings for these.
     
    TeagansDad and Tryz like this.
  7. treshold

    treshold

    Joined:
    Nov 9, 2013
    Posts:
    225
    Regarding bow and arrow motion pack:
    What is the correct place to make check for character that he has arrows? I'm using third party solution for inventory and I found place where I reduce arrows in characters inventory ( after projectile is shot in bow_basicAttacks.cs) but I haven't found spot in code where right clicking starts aiming. I found checks for starting pull the arrow but the moment before :D
    I have a inventory check boolean HasArrows which would return false if quiver is empty. I just need to find correct place to put it so aiming with bow isnt possible if character doesnt have arrows.

    So maybe in Activate ?
     
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    My original thinking was that you would just disable the Bow_WalkRunTarget and Bow_BasicAttacks motions when you ran out of arrows. Then, you'd re-enable them when you had arrows:

    Code (CSharp):
    1. MotionController lMC = gameObject.GetComponent<MotionController>();
    2. lMC.GetMotion<Bow_WalkRunTarget>().IsEnabled = false;
    3. lMC.GetMotion<Bow_BasicAttacks>().IsEnabled = false;
    Depending on what you're using as a camera solution and if you're using that to zoom, you may need to disable/enable that too.

    Eventually I could see that check being made in Bow_WalkRunTarget and Bow_BasicAttacks. For both motions, we'd add a check on the IInventorySource during their TestActivate() functions.

    In both approaches, we are simply trying to prevent the motions from activating when there are no arrows. We actually don't want Activate() to get called.

    The first approach is more flexible as you can do that from anywhere. The second approach means you have to implement an IInventorySource that understands quantity (which I don't have yet).

    I hope that makes sense.
     
    TeagansDad and treshold like this.
  9. treshold

    treshold

    Joined:
    Nov 9, 2013
    Posts:
    225
    Yeah, this works. When I equip bow , I make a check for arrows and if its false these get disabled.

    One thing though that Aiming is disabled but fast shot with left click is still possible.
     
  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Cool.

    Fast shot happens with Bow_BasicAttacks as well. Are you setting that motion to false too?
     
    treshold likes this.
  11. treshold

    treshold

    Joined:
    Nov 9, 2013
    Posts:
    225
    Yeah i thought I did :D
    Now I did some debugging and there was a leak in my code, sorry
    so now it works as expected :p
     
    Tryz likes this.
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I've finished with the Spell Casting Motion Pack NPC demo. Now all I need to do is created some images and text for the asset store page and I'm ready to submit. :)



    I'll be putting this pack out as 'beta'.

    With the ability to create your own spells, there's a lot of moving parts. I expect I'll have lots of requests for new spell actions, spells, and tweaks. Probably the occasional bug or two as well. :)
     
  13. YCE2010

    YCE2010

    Joined:
    Jan 23, 2013
    Posts:
    27
    Hello
    I´m using Third Person Motion Controller by ootii, integrated with InventoryPro. For the integration I used the package MC_InventoryPro and they works perfectly. Now I updated both packages (Third Person Motion Controller and InventoryPro) to last version and I have issues. I have these errors in MC_InventoryPro:

    In InventoryProHandler.cs
    The type or namespace name `ItemChildEquipmentHandler' could not be found
    The type or namespace name `CharacterEquipmentTypeBinder' could not be found
    In InventoryProSource.cs
    The type or namespace name `EquippableSlot' could not be found
    The type or namespace name `Combatant' could not be found.

    The new version of InventoryPro don´t have those types. Is there a new version of MC_InventoryPro?

    Thanks in advance
     
  14. Tryz

    Tryz

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

    I didn't realize Inventory Pro made those changes.

    I'll add it to my list to update, but I'm not sure when I'll get to it. The packages you find on the Vault are free and have limited support. I try to keep them updated, but keeping up with other developers' changes is a full time job in itself. :)

    If you want to make the changes, I'm happy to put your updates on the Vault for everyone.
     
  15. YCE2010

    YCE2010

    Joined:
    Jan 23, 2013
    Posts:
    27
    Ok, thanks you very much for answer. If I get a result I'll let you know.
    Best regards
     
    Tryz likes this.
  16. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Is there some way to allow the player to continue to move/rotate when fighting? The one thing that has really been bothering me about the sword & shield combat is that the player is always rooted to the spot when in combat and that's not generally how you see it in games. The movement is so restricted that it just feels so frustrating.
     
  17. cielph

    cielph

    Joined:
    May 20, 2017
    Posts:
    3
    Hi, I'm doing a small research on this type of game for my school stuff, could you share me a little bit about it. Thanks!
    ----
    Farming is life
     
  18. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Did you try out my Sword & Shield Animset Pro motions that I sent you? I didn't like the rooted feeling either (which, to be fair, is primarily due to the Mixamo animations as the attacks are all stationary), so I replaced all of the attacks with step-and-attack animations from SSAP, the damaged/blocked animations with ones that stagger backwards, etc. There is more I can do to improve how fluid it feels, but it's a start. I think already feels significantly more dynamic that the base Sword & Shield combat.

    What works well is to use the step-and-attack animations when attacking while standing, and to use some of the stationary attack animations on an upper body masked override layer while moving. I tried this with the Sword Animset Pro motions and it worked pretty well.
     
    Tryz and hopeful like this.
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Exactly. The Mixamo animations are free, but that means we're limited to what the animations can do.

    Doing what @TeagansDad has done and using different animations with the combat system is totally doable.

    @magique
    Unfortunately, as someone trying to make a living on the asset store, I have to make decisions that are more broad. In this case, I didn't feel like releasing a pack with another $65 requirement (from another developer) would be a smart thing to do. So, there are some limitations with the free animations. Eventually I plan on having an official Sword & Shield Animset Pro version, but that will come after all the other foundation packs.
     
    Last edited: May 20, 2017
  20. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Not yet, sorry. I will probably give it a try sometime today.

    Well, in Opsive's TPC you can always move and attack. And while the animations are crappy, it works with any animations because he blends upper body/lower body so you can be running while performing an attack. So it's not the animations that are the limitation, but the way the controller is set up.
     
  21. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Nothing about how MC is set up prevents you from doing this; the sample Punch motion included with the controller works while moving.

    The Mixamo set has a pretty small number of attack animations, so it can be difficult to find ones that look good when blended with the walking animations on the base layer. SSAP and SAP have a lot of attack animations, so it's easier to find ones that don't look weird when blending with base layer locomotion.

    I didn't do an upper body layer "Moving Attack" motion for SSAP yet, but what I did for the one that I made for SAP was to give it a higher priority than the "Basic Attacks" motion and have its TestActivate() method check the InputMagnitude value. So I get the step-and-attack animations while stationary, and the blended ones while moving. The step-and-attack ones look fine when moving forward or if WalkRunPivot is active; it's when strafing or walking backwards that they are a bit odd, as the character stops moving sideways/backwards and steps forward when attacking.
     
    Tryz likes this.
  22. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    OK, I'll check it out today and see how it looks/feels.
     
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    As @TeagansDad points out, the MC doesn't prevent you from doing what you want. It's just not what I chose to do given what I saw with the free animations I'm using.

    If you don't like the motions I include, feel free to build your own. The MC lets you do that.
     
  24. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Yes, I understand that it's possible with a different animation controller setup. I was hoping it was setup that way already and I could just change a setting or something. It doesn't make me incorrect. The current setup doesn't work that way, which is what I said. I'm not trying to be difficult. Just trying to get this working the way I want so it's usable in my game. It just means I'll have to invest a lot more time in really digging deep into the controller and animations to perfect it.
     
  25. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey @cielph , I'm not sure what you're asking for. Can you be more specific?
     
  26. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The Spell Casting Motion Pack has been submitted for Unity's approval!



    It will be in beta for a little while as I deal with unexpected issues and feature requests. There's bound to be both. :)

    As we wait for Unity to approve, I'll put together some tutorial videos.

    I've also updated the MC and other assets to prepare for it. Nothing major, but you'll need to update before the SCMP is actually available.
     
  27. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    What is UWP/WSA?

    I probably know this but nothing comes to mind.
     
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Universal Windows Platform / Windows Store App

    They use totally different reflection objects and require special code.
     
  29. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Ah yes. It's basically Silverlight: The Next Generation. :cool:
     
    Tryz likes this.
  30. Sluta

    Sluta

    Joined:
    Aug 15, 2016
    Posts:
    42
    Is it planned to support the use of MC in a hack n slash / isometric game?
     
    Last edited: May 22, 2017
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I know of a couple of teams that are using it with isometric games. They use the SetTargetPosition function with ground clicking to control movement.

    Hack n slash is sort of relative. You can certainly create the motions or see if they Sword and Shield Motion Pack fits your needs.

    So it supports it now. You just have to define the movement mechanics and if you like my combat or not.
     
  32. nathanjams

    nathanjams

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

    I have a more specific question now that I've almost all of my character persistence working. The last issue I have is being able to call different Camera motors from within specific scenes.

    There are two types of scene in our game: one uses a Top Down View Motor and the other uses a 3rd Person Follow.
    I'm struggling to auto-assign a trigger that is located in a scene to reference the Camera Rig (with a don't destroy on load script attached) to call ActivateMotor(int).

    Thanks again to @FargleBargle for all the insight on character and camera persistence. And again, any help is most appreciated.

    Nathan
     
  33. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    If I understand correctly, you want to trigger a different camera motor when you enter a particular area. I have a script that triggers a closeup view when I enter a confined space. While not exactly the same as what you're doing, the same basic approach should work. You'd just need to change the specific camera motor actions to suit your needs. Here are my camera motor settings:

    CameraMotors1.JPG

    You need to have a motor for the new view (in this case "Fixed Follow"), as well as Transition Motors that take you in and out of that view ("Fixed On" and "Fixed Off"). As seen in the picture, I can also toggle the "Fixed Follow" motor using the "Fire2" button, but you can omit including an Action Alias if you just plan to use trigger colliders. I then add this script to a trigger collider that defines the area where the "Fixed Follow" motor is to be used:

    Code (CSharp):
    1. // This script finds an Ootii Camera Controller rig tagged as "CamRig" and activates a camera motor
    2. // called "Fixed On" when a player tagged as "Player" enters a trigger collider containing the script
    3. // and a kinematic rigid body. When the player leaves the trigger, a camera motor called "Fixed Off"
    4. // is activated, to restore the original view.
    5.  
    6. using UnityEngine;
    7. using System.Collections;
    8. using com.ootii.Cameras;
    9.  
    10. public class TriggeredCloseup : MonoBehaviour {
    11.  
    12.     private GameObject camRig; // The camera rig containing the Camera Controller script
    13.     private bool locked = false; //Locks mode when triggered to avoid duplicate trigger actions
    14.  
    15.     //Script initialization
    16.     void Start () {
    17.         StartCoroutine("GetCamera"); //Find Camera Rig
    18.     }
    19.  
    20.     //Find Camera Rig
    21.     IEnumerator GetCamera() {
    22.         yield return new WaitForSeconds(2f);
    23.         camRig = GameObject.FindWithTag("CamRig"); // Get Camera Rig with tag "CamRig"
    24.         if (camRig == null){
    25.             Debug.Log ("No Camera Rig has been found by the Triggered Closeup script. It must have the tag 'CamRig'.");
    26.         }
    27.     }
    28.  
    29.     void OnTriggerEnter (Collider other) {
    30.         if (other.tag == "Player" && !locked) {
    31.             locked = true;
    32.             Debug.Log ("Player has entered Closeup trigger.");
    33.             CameraController lController = camRig.GetComponent<CameraController>();
    34.             TransitionMotor lTransMotor = lController.GetMotor<TransitionMotor>("Fixed On");
    35.             lController.ActivateMotor(lTransMotor);
    36.         }
    37.     }
    38.  
    39.     void OnTriggerStay (Collider other) {
    40.         if (other.tag == "Player" && !locked) {
    41.             locked = true;
    42.         }
    43.     }
    44.  
    45.     void OnTriggerExit (Collider other) {
    46.         if (other.tag == "Player" && locked) {
    47.             Debug.Log ("Player has left Closeup trigger.");
    48.             CameraController lController = camRig.GetComponent<CameraController>();
    49.             TransitionMotor lTransMotor = lController.GetMotor<TransitionMotor>("Fixed Off");
    50.             lController.ActivateMotor(lTransMotor);
    51.             locked = false;
    52.         }
    53.     }
    54. }
    55.  

    The collider (or player) also needs a kinematic rigid body attached. I hope that helps. :)
     
    Last edited: May 24, 2017
    nathanjams, recon0303 and Tryz like this.
  34. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @Tryz, thanks for the new IDamageable interface. It works beautifully and makes it so easy to allow the player to attack anything. I'm using it for destructible objects in the game. :)
     
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Sorry all. I've been wrapped up in some family business.

    @nathanjams , what @FargleBargle posted above is exactly right. Grabbing a reference to the CC and calling ActivateMotor() should be all you need to do.

    You can trust what he says. He'a "Master ootii User" (pronounced 'Moooooo') :D.
     
    Last edited: May 24, 2017
  36. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    Who, me? I wouldn't go that far. I'm still learning, but every once in a while I stumble on something worth passing on (And Moooooo to you too). ;)

    Funny-Cow-Face.jpg
     
    TeagansDad and Tryz like this.
  37. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    hopeful and Tryz like this.
  38. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I saw that as well.

    The big change (for now) seems to be where content is stored and saved. That doesn't really surprise me as Adobe has been pushing their Creative Cloud for a while and part of that is integrated cloud storage for files.

    As for the free part, you may be right. However, I'm wondering if their focus will really be revenue from Fuse and the auto-rigger. The animations that exist now haven't been updated in a long time and I can't imagine they would take 2 or 3 year old animations and swap from free to paid. That said... anything is possible.

    I'll still be looking for other animation packs to build off of. There's a lot more popping up on the asset store. :)
     
  39. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @Tryz - I'm having a lot of frustration in positioning a weapon correctly. Any negative rotation values get "cleaned up" when entered into the fields on the Weapon Core component, but when the weapon is placed in the hand by the inventory source, those "cleaned up" values are often completely and utterly wrong. I don't remember it being this aggravating the last time I set up weapons (was on 5.5 at the time, now on 5.6). I really wish the fields wouldn't act like they know better than me what values to use. ;) When using other controllers/systems where the weapon placement fields don't convert negative or large angles into 0-360 values, I don't run into such problems.

    Any idea why it's acting like this?
     
  40. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I haven't changed any of this.

    Here's what I do to show the pitch, yaw, and roll in degrees instead of the raw quaternion values (which no one would understand ;)):

    Code (CSharp):
    1. Vector3 lValue = rValue.eulerAngles;
    2. Vector3 lEuler = EditorGUILayout.Vector3Field(new GUIContent(rTitle, rTip), lValue);
    3. FieldQuaternionValue = Quaternion.Euler(lEuler);
    I'm just using Unity's 'eulerAngles' property, letting you change those angles, and putting it back as a quaternion with Unity's Euler() function.

    So, I'm not cleaning or modifying the data you put it... but Unity's quaternion functions may be. The thing that's odd is that Unity's quaternion functions may change the angular values, but they should result in the same rotation.

    I could stop storing the quaternion and use raw floats for pitch, yaw, and roll. At run-time I still have to convert them to a quaternion in order to avoid gimble lock.

    [EDIT]
    When you are getting the values to enter into the Sword Core, are you actually attaching the sword to the right-hand bone? You'll have to in order to see the 'local' rotation vs. the 'world' rotation.
     
  41. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @Tryz - The Swotd & Shield MP docs state that Unity is cleaning up the rotation values, so that's why I use the term.

    I've noticed odd behaviour from it before when entering values that I obtain at run-time -- quite often I enter the values, then find at least one angle off when I run it and have to get new angles again. And sometimes the order in which I enter the rotation values changes the "cleaned up" values in the Weapon Core.

    I've had the same issue when setting up mount points on a character as well. The cleaned up rotation values don't always give me the same orientation as on the transform when it's been positioned correctly at run-time.

    And yes, I'm attaching the weapon to the right hand bone. Unless I ensure that I adjust it such that all rotation values are between 0 and 360, I often get unpredictable results when I run the game and test the item positioning -- with both the default placement using the Weapon Core values, and also sometimes when setting up Mount Points. Usually I only have to do it a second time after the "normalized" rotation values are calculated. Today it just doesn't want to work period (haven't installed Mount Points in this project as I'll eventually be using UMA).
     
  42. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Give me a day and I'll build a version that doesn't decode and encode the quaternion. That should at least keep Unity from changing the values you set. I'm not sure if the run-time conversion will have the 'not the same orientation' issue. That one baffles me because Unity's Quaterion class should be giving the same values.
     
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I've been putting up some videos for the Spell Casting Motion Pack. Here's a good intro to what the Spell Casting Motion Pack is.

     
  44. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    353
    Hey Tim quick question have the spell motion pack controller support ?
     
  45. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hi @Salja , I think you're asking about Xbox controller support. If so, yes... it will work with an Xbox controller.
     
    Salja likes this.
  46. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    353
    Nice thank you
     
    Tryz likes this.
  47. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    Wouldn't surprise me if they keep aiming for this......SAD to as I been a huge Adobe user for years, and years, but CS6 Web, was my last version I will buy... Far as the auto rigger its great for people with out MAYA, as Maya has it own auto rigger, its better to.. But I would never depend on an auto rigger for anything but prototype .. I have fixed to many assets on the store and other work due to auto riggers sadly. But again as I said auto riggers are great to get someone going, and for prototype work.. I hate that Adobe , Auto Desk has went Full Sub... Maya 2016 is my last version I will buy for Maya as well... as I will move to Modo, and have a bit already with modeling ....

    These companies should offer sub and to be able to buy it still in my opinion.. Major turn off .. for people like me.. hate sub ugh.
     
    Last edited: May 25, 2017
    Tryz likes this.
  48. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    Ya sadly UWP, sucks....in my opinion anyways. . I use it for testing, and stuff, but they force you to make a XB1 and windows build, plus the kit is lacking compared to the normal dev kit... Its good to get you going if you don't want a build for both platforms.. but from experience, I can't stand it. But its cheap and great to get access and test stuff on, if I remember it was 19 bucks, I think...They did make it better, where you can set the amount you use for your hard drive on your XB1, before you had to wipe it...Which really annoyed me and many others..or you had to use an external for all your games.. But thankfully they fixed it due to all the complaints..With time, I'm sure it will get better.. You still have to get the same approval to get your game on as before...You just are required to release XB1 and Windows, which is a turn off. as some games I rather just do XB1 not windows. They should give you a choice. So that means you have to do it the old way and get a dev kit if you want to go that route...
     
    Tryz likes this.
  49. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    If you want to learn out to create spells, this video is for you. ;)

     
    Malbers, recon0303, hopeful and 2 others like this.
  50. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I had a question about timing... I've got a couple of things going on in my frame. Early in Update() (using Script Order Manager) I do a raycast from the camera to get the point I'm looking at. I use that in a few things like GUI, crosshairs, etc. Then in LateUpdate() CameraController and MotionController update, which will change the point the camera's actually looking at. Meanwhile I've also got FinalIK trying to aim the player's gun and head towards that point from the beginning of the frame, which I believe happens during FixedUpdate. All this results in jitter when spinning around quickly due to the actual camera LookAt point not being consistent throughout the frame and during the FixedUpdate step. Is there a way to get this all working more smoothly?