Search Unity

Motion Controller

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

  1. marcelomg

    marcelomg

    Joined:
    Dec 27, 2013
    Posts:
    4
    Hi,
    I just got the shooter pack and I am having the same issue. Everything works on the Demo scene. Also, it works with the Proto character when I start everything from a blank scene. When I import any new character (I'm using the Challenger from The Blacksmith and some characters from Mixamo), the character's upper body gets all distorted when I equip the weapons from the Shooter. I'm new to Unity so I'm not sure how to disable the UK options as you mentioned. Could you provide some steps to troubleshoot this?

    I'm using Unity 2018.5f1 and Shooter 2.8

    Thanks for any help.
     

    Attached Files:

  2. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    614
    Hi there,
    I'm new to NPC animation and am wondering, for a VR title where you want the enemy to target attacks and blocks to the player's weapon or headset, is this possible in Motion Controller?
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Hey Marcelo,

    Because the gun isn't set correctly for your character's hand bone, the spine IK is rotating the gun to an odd angle which is distorting the character. I have example images of the twisting in the tips & tricks post.

    First, check out the documentation for setting the gun correctly for your skeleton:
    Gun Core

    Next, check out the documentation about the spine IK:
    Shooter Motion Pack - Tips & Tricks

    Once you set the gun correctly, you will be fine. :)
     
  4. Tryz

    Tryz

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

    The MC will allow the NPCs to attack and block, but your AI code/tree will need to control the NPC's target position and rotation.

    Think of it like a hammer... the MC knows how to hit, take damage, and apply damage, but you need to determine when it hits, where it hits, and how often it hits.
     
  5. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    614
    gotcha.
     
  6. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I'm having an issue that's driving me crazy... I've got some custom equip and store animations and for some reason every once in a while it fails to fire the animation event that the motion needs to equip/remove items. I've triple-checked and the event is there, it does fire sometimes. It's a one second animation, and the transitions going in and out are set to 0.1 seconds, and the event is right in the middle, so I can't see how it could possibly be in any sort of transition phase where it would skip it. Anyone have any advice?
     
  7. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    I was looking for something to drive my NPC and by watching NPCs tutorials I see that NodeCanvas, are you still advising it also with Unity 2018.3?
     
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    The only two things I've seen stop the equip from working you've already mentioned:
    1. Missing animation events
    2. Animation events happening in transitions

    Is it possible that the incoming transition is being based on the "start" animation and is running longer than the 0.1 seconds you expect? Unfortunately, that's all I've got. :(
     
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Unfortunately, it's been a while since I played with NodeCanvas and I haven't in Unity 2018.3.
     
  10. stuartdn

    stuartdn

    Joined:
    Feb 3, 2018
    Posts:
    14
    Hi,

    I have the shooter motion pack set-up with a custom character and it is mostly working well. However the Support hand isn't working when using Rifles meaning the Left hand isn't naturally supporting the gun. After some exploration I've noticed that the code used to drive the support arm is calling the bone by name.

    Transform lLowerArm = mMotionController.Animator.GetBoneTransform(HumanBodyBones.LeftLowerArm);
    Transform lLeftHand = mMotionController.Animator.GetBoneTransform(HumanBodyBones.LeftHand);

    However the rigs I am using have the Left Hand and Left Lower Arm named different to Unity's naming conventions. I thought that Unity would be smart enough to know that the hand and arm it's using for animations are the same ones to trigger IK events on but it wouldn't appear so. I don't have software to change the name of the bones in the rig outside of Unity and any time I try and change the bone names in Unity the arm is stiff when running animations but does move to the correct position when holding a rifle.

    Do you have a suggestion for how I can get round this?

    Cheers,
    Stuart
     
  11. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    The good news is that still under development and we are getting closer to 3.0 version, so I guess it will work with the newest version of unity.

    By the way I have purchased it because I guess it's very fast for artificial intelligence prototyping. For sure is fastest then typing a new c# script from scratch.
     
  12. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    Hi Stuart,

    Are you using the generic rig? Since the Animator.GetBoneTransform() needs to have an avatar correctly set up for humanoid to locate the transform, It is not actually using the hierarchy name but going through the animators avatar (Not 100% sure about that so don't quote me haha) You should be able to use characterTransform.Find("myBoneName") to return the transform of a specific chilld in a game object regardless.

    Let me know how it goes!
     
  13. stuartdn

    stuartdn

    Joined:
    Feb 3, 2018
    Posts:
    14
    Hi Subliminum,

    Thanks for coming back to me. It is a correctly set-up Humanoid Rig. It seems that Unity is smart enough to figure out that certain bones match their presets for animations but not for IK.

    I've tried your suggestion of using the bones Transforms but without any luck. I think because the bone transform is linked to the animator it must be provided relative to the animation or something.

    Have contacted the guy who built the character to see if he can produce a version of the character with the bones correctly named, and whether that will solve it. Although that's not ideal.

    Any other ideas in the interim?

    Cheers,
    Stuart
     
  14. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I think you might be right... I checked and one of the incoming unequip transitions was set to 0.1 normalized time instead of specific time, and it's possible it was happening when the unequip was interrupting a really long attack combo animation. Tentatively might have fixed it changing it to specific time. I did notice that this means sometimes the animation events from the attack (BeginFOA, Hit, EndFOA) actually get sent to the store motion instead of the attack motion if they happen during the animation transition, but it seems like that doesn't have any particularly weird effects yet.
     
  15. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    That is quite frustrating. I had hoped that you were using a generic rig without an avatar, and it could be an easy fix. I've read in a few places that sometimes the 'Optimize Game Objects" check in the model import tab has been enabled. If so, you can then manually expose the transforms to be accessed using the methods we already discussed (A possible fix if your GetBoneTransfrom is returning null)
    My only other suggestion would be to install Blender, import your character and re-rig it yourself and see if that lets Unity correctly detect your IK Bones. You can always email me the file id be happy to rig it for you, its pretty straight forward if its all weighted and can import correctly!

    Fingers crossed. :)
    Subliminum.
     
    Last edited: Jan 11, 2019
  16. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    About archery, I read the manual and followed the youtube tutorial I really can't get how to set-up (and center) where the arrow get shot.
    Can you help me ? :rolleyes:


    Also I still get this error, but I can't get how to fix it, 'cause on scene I've a single character which isn't with kinematic option on, and there's nothing more with a rigid-body on scene.

    Code (CSharp):
    1. [Physics.PhysX] RigidBody::setRigidBodyFlag: kinematic bodies with CCD enabled are not supported! CCD will be ignored.
    2. UnityEngine.Resources:Load(String)
    3. com.ootii.Actors.Inventory.BasicInventory:CreateAndMountItem(GameObject, String, Vector3, Quaternion, String, String) (at New Unity Project/Assets/ootii/Assets/Framework_v1/Code/Actors/Inventory/BasicInventory/BasicInventory.cs:1178)
    4. com.ootii.Actors.Inventory.BasicInventory:EquipItem(String, String, String) (at New Unity Project/Assets/ootii/Assets/Framework_v1/Code/Actors/Inventory/BasicInventory/BasicInventory.cs:408)
    5. com.ootii.MotionControllerPacks.BasicItemEquip:CreateItem() (at New Unity Project/Assets/ootii/Assets/MotionController/Code/Actors/AnimationControllers/MotionController/Motions/BasicItemEquip.cs:413)
    6. com.ootii.MotionControllerPacks.BasicItemEquip:OnAnimationEvent(AnimationEvent) (at New Unity Project/Assets/ootii/Assets/MotionController/Code/Actors/AnimationControllers/MotionController/Motions/BasicItemEquip.cs:336)
    7. com.ootii.Actors.AnimationControllers.MotionControllerLayer:OnAnimationEvent(AnimationEvent) (at New Unity Project/Assets/ootii/Assets/MotionController/Code/Actors/AnimationControllers/MotionController/MotionControllerLayer.cs:713)
    8. com.ootii.Actors.AnimationControllers.MotionController:OnAnimationEvent(AnimationEvent) (at New Unity Project/Assets/ootii/Assets/MotionController/Code/Actors/AnimationControllers/MotionController/MotionController.cs:2493)
    [EDIT]
    I Get this error when I press 1, which mean Shield and Sword, so I've discovered that the Sword_01_collider_ap have the rigidbody set as kinematic but if I disable the option, the sword start spinning like a plane propeller o_O
     
    Last edited: Jan 11, 2019
  17. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    Hello MaximilanPs,

    You can find where the arrow projectile is set up in the BasicRangedAttack.cs in the ReleaseProjectile() function. The code is well documented and easy to modify if you wish.
    Here is a forum post which explains the
    [Physics.PhysX] RigidBody::setRigidBodyFlag: kinematic bodies with CCD enabled are not supported! CCD will be ignored.
    warning/bug. https://forum.unity.com/threads/kin...nabled-are-not-supported.598723/#post-4082263

    As for as your other errors im unsure.

    Good luck.

    EDIT: If you're using the S&S pack ensure that your BasicInventory is setup correctly for those motions as well as the archery pack you're already using. That could explain some of your other errors
     
    MaximilianPs likes this.
  18. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    I see this happening occasionally as well. It doesn't happen often, but maybe 2% to 3% of the time. That number is just my gut feeling and is not based on any actual measurements. I have no idea why it happens, unfortunately.

    One solution that I've had in the back of my mind for a little while is simply to force the BasicItemEquip and BasicItemStore motions to equip or store the weapon if the animation event has not been raised by a specified normalized time stamp (which could be defined alongside the equip/store motions and forms). Also, I would force the equip/store when the motion ends if for some reason it hasn't been triggered yet.

    Many equip/store animations are frankly too slow to use as-is if you want responsive, real-time gameplay. I make heavy use of Kubold's and Riko's animation packs and while the equip/store animations look very realistic, they're positively lethargic when you're trying to draw a weapon or swap weapons when an enemy is right in front of you. This necessitates speeding up the equip/store animations, which further increases the likelihood of the animation event getting missed -- especially if the frame where the equip event is close to the start of the animation clip (which it is in most of Kubold's animations). The vast majority of third-person action/adventure or action/RPG games allow for weapons to be drawn or switched out very quickly.

    So having the BasicItemEquip and BasicItemStore motions ensure that the weapon prefab gets attached or removed correctly is a change that should probably be made at some point anyway.
     
    makeshiftwings likes this.
  19. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Yeah, I noticed this error message appearing as soon as I updated a project to Unity 2018.3 (which I only did for the first time this past week; had been on 2018.2.6f1 for quite a while). From the post you linked, it looks like PhysX essentially ignores the Collisions setting anyway and defaults to Discrete. So @Tryz or I should adjust all of the weapon prefabs in the Sword & Shield Motion Packs to reflect this and get rid of the warning message (I can take care of that, Tim).
     
    Subliminum likes this.
  20. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    To push forward... i've Downgraded my Unity to 2018.2.18f1
    All issue are gone but still some... strange behavior with the entire package:
    I don't know if it's me, but when I've used the wizard to set-up the player, the body collider was set at 3 meters.
    Also, the Camera (I've the advanced package) was set with a distance of 30.000 units, and the Targeting in/out with a transition time of 25 seconds! (all with Unity 2018.3)

    I've fixed all by hand, but I'm pretty scared about more weird parameters, which I could discover further :confused:

    Anyway with 2018.2.18f1 (all issue disappear looks like, also the wizard is working fine)

    For example did this bow looks correct? (is the one in the package)
     
    Last edited: Jan 11, 2019
  21. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    For some reason, your values are getting multiplied by 10 or 100.

    The Wizard's setup profiles call static functions in ootii/Assets/MotionController/Code/Setup/Helpers/CharacterSetupHelper.cs to configure the ActorController:

    The BaseRadius on the ActorController is set to 0.3f
    The Body Capsule (in BodyShapes) is given a radius of 0.3f with an offset of (0f, 0.6f, 0f)​


    If you don't check "Use Camera Prefab," the default Camera Controller settings are created in ootii/Assets/MotionController/Code/Setup/Helpers/CameraSetupHelper.cs:

    The Distance on both 3rd Person motors is set to 3.0f
    The Transition Time on Targeting In is 0.15f
    The Transition Time on Targeting Out is 0.25f
    I see that you're in Italy, so the only thing I can think of is that there's some localization setting that is messing with the float values. Has the Wizard always behaved this way for you? Does anything else exhibit similar behaviour?

    EDIT: Yes, I was right about localization issues: https://forum.unity.com/threads/editor-is-using-windows-locale-settings.442847/#post-3958150

    Seems like there have been some attempts to fix this over the past two years. Some have reported encountering the issue after switching the Scripting Runtime to ".NET 4.x Equivalent". The thread I linked to has a simple (not necessarily ideal) fix for the issue.
     
    Last edited: Jan 11, 2019
    MaximilianPs likes this.
  22. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    it works always fine, but now that you mention it, I notice that Unity start using decimal with comma (which is correct in italian) instead of the full-stop.
    I will investigate on it, maybe changing the Windows international setting could help.
     
  23. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    No, don't mess with the international settings. ;)

    I edited the above post with a link to a fix, but you may not get an alert for that.
     
  24. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    yep we are chatting too fast :D
    Thank you !
     
  25. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @MaximilianPs - actually, it all made sense to me as soon as I walked away from the computer for a minute to get a glass of water. :cool:

    You probably aren't running into this issue with fields directly on MonoBehaviour or ScriptableObject classes. These inherit from UnityEngine.Object and thus are serialized using Unity's built-in serialization system.

    But you have run into the issue on Body Shapes and Camera Motors, and I suspect that if you look closely, you'll find that it is also popping up on some Motions as well. These are all classes which inherit from plain C# classes (sometimes a few levels down) and not from UnityEngine.Object. Because Unity's serialization system does not preserve inheritance (classes get deserialized as their base types, which is useless), these classes are all serialized using a custom JSON serializer, which (at least currently) just serializes numeric values using ToString() without specifying any CultureInfo parameter.

    Most of the objects which exist in collections on the various ootii components are serialized this way (Camera Motors, Body Shapes, Motions, Reactors, Actor States, Bone Motors, etc). In the short term, forcing the Unity Editor to use CultureInfo.InvariantCulture will probably do the trick. But in the long-term, the serialization model used for the custom classes probably needs to be updated or replaced.
     
    Subliminum likes this.
  26. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @MaximilianPs - Check the IK settings on your Basic Ranged Attack. They might be messing with your archer's pose. The defaults should be:

    upload_2019-1-11_14-37-21.png
     
    MaximilianPs likes this.
  27. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    I see @TeagansDad is demonstrating his mastery of Motion Controller today. GJ! :D
     
    TeagansDad likes this.
  28. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    @TeagansDad YES !
    With 2018.2.18f1 and the FixCultureEditor finally everything works fine! :)

    I don't get how to set a gameobject as socket to store items.
    I mean I've made an empty-game object for the right and left hand, where I would like to mount the weapon and shield.
    I've called 'em "RIGHT_HAND" and "LEFT_HAND" but the items still get mounted on bones.

    What I'm missing?
     
    TeagansDad, Subliminum and hopeful like this.
  29. stuartdn

    stuartdn

    Joined:
    Feb 3, 2018
    Posts:
    14
    Hi Subliminum,

    Thanks for the suggestions and offer to do a conversion for me. I'm not sure the bone naming is the problem now.

    The 3D artist sent me a revised version of one of the characters with all of the joints matching Unitys naming conventions and it is still not working correctly. See the screenshot below.

    Support arm IK not working.JPG

    The animations are set to use arm IK and the animator is set-up to use IK yet the hand still isn't in the correct place. So I'm not sure why it isn't working. One of the artists other characters that isn't working is this free asset.

    https://assetstore.unity.com/packages/3d/characters/humanoids/post-apocalypse-girl-114371

    Perhaps you can see if this one would work for you out of the box as it were to see if the bones are the issue or it's something to do with my set-up?

    Before the artist sent me the revised file I used Autodesks FBX converter on the Apocalypse girl to convert it to a binary FBX file so Blender would read it but when I imported it it was at an odd angle and wasn't as smooth so think there was something wrong with the conversion. So haven't had any luck trying her with renamed bones.

    Cheers,

    Stuart
     
  30. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    Hi Maximillian,

    Unless you own Mount Points by Ootii (Not necessary for using the MC), you will need to manually set the local offset for each weapon. since their intended behavior is to parent to the bone.



    The start of this video tutorial covers that process and also cover setting up your own weapons.

    Subliminum.
     
    MaximilianPs likes this.
  31. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    Hi Stuart,

    I do not own that particular Asset from Maksim Bugrimov, however i do own the https://assetstore.unity.com/packages/3d/characters/humanoids/pbr-customized-soldier-111945. Hopefully this will work similar to your other models, I'm doing a quick test now to see if it will work the Motion Controller and the Shooter MP out of the box. My guess is that all his models will present the same issues that you are experiencing but hopefully this sheds some light on it.

    Subliminum.

    EDIT: Okay i have had a look at it now. I'm not sure if your model will be rigged exactly the same but it had an extra root bone in the bone hierarchy and that seemed to be giving the IK system some problems in my scene. Even when i got it partially working the support arm did not seem to be working correctly either? I'm pretty stumped as to the exact cause of this or how to go about a fix. Ive been able to replicate this problem with my own model and project also so it could be that the arm support IK isnt working correctly, we might have to summon the elders @Tryz @TeagansDad haha :)
     
    Last edited: Jan 13, 2019
  32. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    I've watched this tut tons of times, but I still not getting able to shot arrow on the right place, so maybe making a my own Mount Point is a good choice, but I can't understand how.

    Also I would like to create a mount-point for sword and bow on "out of combat". when they are in sheath.
    So I guess I've to define some custom mount-point in any case..




    [EDIT]
    Maybe I've found a source to study :)
    https://ootiigames.com/?page_id=1334

    [EDIT2]
    For some reason I didn't have the
    Scripts\ootii\MountPoints\Actors\MountPoints scripts!!! :eek:

    indeed in the "demo_SSMP_MountPoints (Attack Profiles)" the Player (game object) have a missing component!

    [EDIT3]
    Ok it's an extra-component :D:oops:
    https://assetstore.unity.com/packages/tools/animation/mount-points-16318
     
    Last edited: Jan 13, 2019
    Subliminum likes this.
  33. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    Mount Points is another Asset by Ootii which makes that process a little bit simpler and has extended features such as mounting clothes to skinned meshes and masking. You should be still able to still have your weapons on-body without it.
    You can always just parent an instance of the weapon somewhere on your character in the scene(the thigh for example) and then link that to the Basic Inventory instead of instantiating one from the resources folder. This will mean the weapon is equipped from and placed back in its original location(the thigh) after you've unequipped it.
    So if you had the sword on the thigh and the shield/bow on the back or something that would work. ;)

    Subliminum.
     
    Last edited: Jan 13, 2019
  34. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    Still have a strange position, but it could be fine. :)



    what I really hate is that at the end I've been forced to use a reticle... which I really hate o_O

    yes it's the barley visibile darkish circle... ;)
     
  35. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    Glad it worked for you! As I said above, the serialization for custom objects probably needs to be changed, but in the meantime the editor fix should be sufficient.

    You need to use different names for your mount game objects. "Right_Weapon_Mount" and "Left_Weapon_Mount" for example. If you have a large number of weapons in your game, you might need to get more specific, such as having a "Sword_Mount" and a "Pistol_Mount" on the right hand in order to avoid having to set up position/rotation overrides on every weapon.

    As for the why: In BasicInventory.cs, look for the FindTransform() function (should be line 1311). This is what locates the transform on the skeleton on which to mount the item. First, it checks to see if the provided name matches one of the Humanoid bone names (BasicInventory builds and caches a list of these in its Awake() method from the UnityEngine.HumanBodyBones enum, converted to lowercase). If it doesn't find a match there, then it just looks for a transform in the gameobject's hierarchy with the specified name. And if it still doesn't find a match, then it returns the root transform.

    If you look in both Awake() and FindTransform(), you'll see that they both use the StringHelper.CleanString() function, which will convert everything to lowercase and remove any spaces or underscores. So "RIGHT_HAND" gets converted to "righthand" and thus matches the bone name HumanoidBodyBones.RightHand (stored as "righthand" in BasicInventory.UnityBones).
     
    MaximilianPs and hopeful like this.
  36. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    @Tryz will need to field this one for now. IK is one of those areas of Unity where I haven't really spent any time seriously learning and understanding the nuts and bolts of how it works. It's on my to-do list. :cool:

    @MaximilianPs - If you're relatively new to using Motion Controller, I would recommend using a character model with the Mixamo skeleton until you've got everything working the way you want it to (at least everything related to the character controller), as all of the official Motion Packs were built using the Mixamo skeleton and animations. My primary motivation for building (what evolved into) the Character Wizard tool was that I was frequently setting up new projects, scenes, and/or characters from scratch and wasting a lot of time trying to figure out why something wasn't working. It was always due to an oversight on my part, but this framework is very configurable and customizable and thus it is easy to miss something even if you're very familiar with it. IMO the key to software/game development is limiting the number of unknowns that you're working with at any one point in time. ;)

    So I still tend to use the Y-bot model (the one in all of the MC demos) for most of my prototyping and early development, as it eliminates one source of potential issues. Once I have it working on the Y-bot, I can be reasonably certain that any issues I experience using that same setup on another model is due to how that model's skeleton is set up. (Doesn't have to be the Y-bot; any characters created in Fuse use the same skeleton, as do most of the free models on Mixamo's site although some of the older ones can be a bit wonky).
     
    Tryz, MaximilianPs and Subliminum like this.
  37. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    On a related note to what we've been discussing on this page, I'm currently working on an enhanced "Advanced Inventory" add-on. It is more opinionated than BasicInventory -- as in, it makes more assumptions about how you want your inventory/equipment system to work. I'm looking to the 3rd person action/RPG and action/adventure games that I play as examples as to how equipping items should work: The Legend of Zelda: Breath of the Wild, Skyrim, Risen, etc. So when you "equip" a weapon in the GUI, it will be visually attached to the character (defaulting to the stored/sheathed location), and the player can draw or store the weapon with a specific button or key. I would like to include the option of being able to have something like you see in Breath of the Wild, where you can equip a set of melee weapons (sword & shield) and a set of ranged weapons (bow), all of those items will be visible on the character, and you would have a different button/key for each set.

    Equipment Sets are a central concept in this system. They're an extension of the concept of Weapon Sets, but they're where you define the rules/settings for how items of that type are equipped:

    upload_2019-1-13_11-0-16.png

    These Equipment Sets are stored as assets, and you would create one for each broad class of weapon (one-handed swords, sword & shield, bow & arrow, two-handed sword, etc). As you can see in the screenshot, right now it contains references to specific weapons; this will be changed so that it references types of items. Thus, equipping a one-handed sword and a shield will use the Equipment Set with Primary Item Type: One-Handed Swords and Secondary Item Type: Shields.

    Movement States are used to determine how the movement style, camera, controls, etc will change when the item(s) is/are equipped. I don't actually have them implemented in-game yet; I've just created the data representation for them.

    Equipment Sets are also a more natural home for the concept of Attack Profiles, as those are closely tied to the animation clips used. If you use different animations when a one-handed sword is equipped on its own versus when it is equipped with a shield, then you would probably want to use a different Attack Profile as well.

    Anyway, this is still fairly early in development, I haven't decided how to distribute it, and I'm not going to give any sort of ETA. ;) Just wanted to show you guys and maybe get a bit of feedback/input on the idea.
     
    drcfrx, crazymonkey7787, Tryz and 3 others like this.
  38. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    That is some nifty work and sounds like a great idea! I have manually assigned slots for each my collected weapons to store on my character( If there is already a weapon in the slot, it is switched or dropped) and the system is still quite janky haha. I love the concept of having a neat data framework for each weapon to declare how it will behave in various ways when collected. A suggestion for weapons categorization would be;
    -2h Bladed (Claymore)
    -1h Bladed (Long knife or short sword)
    -2h Blunt (Sledgehammer)
    -1h Blunt (Pipe or piece of wood)
    -Defensive (Shields or Armor)
    -Ballistics (Bows, Firearms, Crossbows)
    -Special (Flamethrowers, Magic and misc)
    I would find this useful for applying specific damages and effects to ragdolls in my project. Keep up the top notch stuff, id be happy to help if there's anything i can do. :)
     
  39. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    322
    Yes I'm working with Mixamo bones.

    That's exactly (about) what I'm working on.
    Player would be able to set an "active weapon" and shield that will appear on the player, just like Skyrim or Kingdom Come, where you can have 5 sword in inventory, but just one can be equipped, and if not in hand, it should appear on the sheathe.

    Anyway, if some good soul could create a tutorial on bow and centering target, would be awesome, cause my bow still shot with a 40° of misalignment :(o_O:D
     
  40. nrodemund

    nrodemund

    Joined:
    Sep 15, 2018
    Posts:
    16
    hmm.....not convinced.... this (3rd person motion controller) is not really...."zero alloc"...

    upload_2019-1-15_18-1-6.png

    Any solution for that issue? Settings are pretty default (tutorial)

    Obviosly I cannot do any Deep Profile as 32gb ram would not be enough to profile that bug
     
    Last edited: Jan 14, 2019
  41. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    These will all be user-definable. The "Item type" class is a ScriptableObject, so you just create an asset for each item category/type that you want to use and modify the settings accordingly.

    The idea is that the user-defined data types are where behaviours will be defined, including but not limited to: where the item is mounted, what motion to animate with, what items it can form a Weapon Set together, how movement/camera settings change with different weapon sets, which items can be equipped to an equivalent slot, what effects an item has when equipped or used, new actions that an item makes available when equipped, how to calculate damage when attacking with a weapon, etc.
     
    Tryz, MaximilianPs and Subliminum like this.
  42. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    That's definitely not normal. The only thing I can think is it has to do with something in your scene. Maybe a crazy complex collider or something with Unity 2018.3.

    This weekend I'll test with my demo scenes and Unity 2018.3 on PC.

    You can do a deep profile on my demo scenes and then find the difference with your scene.
     
    TeagansDad likes this.
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    Sorry for the delays everyone. Just getting settled in Japan and the new job. Crazy times.

    I'll be following up this weekend, but you are in good hands with @TeagansDad .
     
    KeithBrown, Subliminum and TeagansDad like this.
  44. stuartdn

    stuartdn

    Joined:
    Feb 3, 2018
    Posts:
    14
    Hi Subliminum,

    Thanks for looking into this and trying it with the Soldier characters yourself. I didn't have any further luck with Maksims characters even with the new bone names.

    Based on an previous post saying that the motion controller should work out the box with Fuse / Mixamo characters I went off and created my own Fuse 1.3 character (hadn't used it before it's amazing!) to see if hand IK would work properly with that. I've found that with my own Fuse character when the character is moved the hand flips between the IK position and it's default position. When the character is aiming the hand doesn't go to the IK position at all.

    Hopefully @Tryz and / or @TeagansDad might have an explanation and way to get around this.

    Cheers,

    Stuart
     
  45. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    Hello Stuart,

    I've had a further dive into this issues and it seem quite likely the IK is the issue. I added the RotateArmToSupport(); line in a few spots in the BasicShooterAttack.cs where it appeared to be missing (might explain the hand not moving when aiming). You can try adding this
    if (mGunSupport != null) { RotateArmToSupport(mGunSupport.position, mLookIKWeight); }
    to lines 672,702,820 just after the SpineIK in the BasicShooterAttack.cs. This enabled the IK for aiming in my project, however its functionality is limited. I've been planning on using Final IK for extending the IK in my project but hopefully Tim can explain whats going on in more detail when he gets a chance to look at these messages.
    There is a summary of the function here https://ootiigames.com/?page_id=1028

    Subliminum.
     
    Last edited: Jan 17, 2019
    Tryz and stuartdn like this.
  46. stuartdn

    stuartdn

    Joined:
    Feb 3, 2018
    Posts:
    14
    Hi Subliminum,

    Thanks for taking the time to figure this out. I've just tried updating the code and the arm now moves to the IK position in both the idle and aiming poses!

    It's still flicking between the support position and it's default position as I move the player but looks like things are on the right track. Does it do that for you?

    I'm going to try adjust the settings to see if that stops the flickering. Will let you know how I get on.

    Cheers,

    Stuart
     
  47. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    Glad to hear it,
    Yes it still behaves strangely in a few ways but i'm not sure if that's by design or not since i have a strange setup. A lot of the time the issues i've gotten have been animation related. How are you moving your character, is it using the default animations for the package? Can you provide a video or GIF of the behavior so we can narrow it down?
     
  48. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    I just sent you an email.

    I'm testing on Unity 2018.3.0f2 PC and not seeing any kind of allocation like what you're showing. I'm using the demo_Terrain scene that I provide in the asset. This is what I see after running around a bit:



    Since no one else is reporting this, I think there's something in your scene. In the end, I'm just using Unity's physics engine. Maybe you've got a crazy complex collider or you're using an invalid collider. For example, Unity's physics engine doesn't support concave colliders.

    Please do the following:
    1. Test my raw demo_Terrain scene (with no changes)
    2. Compare your scene to mine. Remove pieces as need.

    I'm betting you're going to find some geometry that Unity considers invalid.
     
    TeagansDad likes this.
  49. Tryz

    Tryz

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

    40-degrees is a big gap. The arrow is going to launch based on how it's position in the bow and the bow is going to fire based on how it's positioned in the hand. Since we're dealing with angles and distance, a small angular error in the beginning could have a big impact 10 yards away.

    So, a couple of things to check:

    1. Ensure your Bow Core's "Local Position" and "Local Rotation" match your character's bone that it is placed in. By default, that's the "Left Hand". This doesn't have to be perfect, but the 'nock' rotation will come from the bow's rotation.

    2. Ensure your Bow Core's 'nock' is positioned and rotated correctly. This is where the arrow sits and it determines the direction of the arrow.



    3. Make sure the arrow isn't released too early or late with your character. When the animation plays to release the arrow, the arrow is based on the nock which is based on the bow which is based on the left hand.

    Let's say the animation event that fires the bow is too late. You could shoot the arrow when the bow is being put down like this:



    When Unity transfers animations between characters, extra bones, lack of bones, and skeleton changes can create small differences in the animation direction. So, you just want to look if your character may have an odd position when my default animation event fires from the nook.

    I hope all that gives you somethings to look at.

    If it still doesn't help, email tim@ootii.com your character and maybe I can play with it next weekend.
     
    MaximilianPs, TeagansDad and Weblox like this.
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,402
    @stuartdn thanks for being patient. I'm going through some huge life changes right now. :eek:

    @Subliminum thank you for jumping in. It is super appreciated! :D

    I'm trying to catch up, but maybe this will help...

    The support "IK" I talk about here (Left Arm IK) is a cheap solution because IK is tough. It really isn't IK as much as me adjusting the left fore arm to point in the direction of the "support" transform on the gun.

    Note: That's the reason that I suggest an IK solution like Final IK. Being honest... I think Final IK would be a more robust solution than my Bone Controller asset.

    So, what am I doing with this "cheap solution"?

    We have a "Left Arm" bone (elbow) and a "Left Hand" bone (wrist). This is the direction of the bone based on the animation.



    I use the transform of the "Support" on the gun to change the direction of the "Left Arm" bone (elbow):



    This means the support needs to be placed to support the "direction".

    The other thing to remember is the "Left Hand" bone in the Mixamo characters isn't the "hand"... it's the "wrist". So, you have to account for that too.

    In a true IK solution (like Final IK), some bone in the center of the left hand would go exactly on the "Support" transform. That would force the position of the wrist, cause the elbow to move back, and even change the rotation of the shoulder. It can get complex as IK works backwards to change the position and rotation of all these bones.

    Hence my "cheap" solution which just changes the direction of the forearm.

    I hope that helps. If it doesn't, please re-tell me the details. That will be easier than me trying to pour through the past posts. :(

    Thanks again for understanding.
     
    KeithBrown, Subliminum and TeagansDad like this.