How to set CharacterIK with integration between UCC and UIS

Hi,

I have some difficulties to figure out how to add "Body" object for hands fighting with an integration with UCC and UIS.

I tried with the same approach that means creating a pickup object at runtime but I am stuck when it comes to set the hitboxes of Third Person Melee Weapon Properties:

Hitboxes Colliders.png

How to assign those colliders at runtime?

I wonder if we can do that without coding? If yes, could you put me on the right way?

Thank you in advance for your help
 

Attachments

  • CharacterIK with Inventory.png
    CharacterIK with Inventory.png
    58.5 KB · Views: 9
  • Inventory CharacterIK error message.png
    Inventory CharacterIK error message.png
    20.6 KB · Views: 8
Last edited:
For this issue, I have also tried to add this item in the loadout of Inventory. It is quite working and I can punch and kick but I get an error and the camera doesn't work correctly. It looks at anywhere I point the cursor:


Error2.png

As it is an empty object I cannot figure out how to proceed to treat this case.


I see the integration demo and I didn't see the hands fighting item.

Any help could be nice.

Thanks
 
Last edited:
I ran in to the same issue and I fixed it by adding a script to my player that found the 4 hand and feet colliders (that you would have created when you added the body) and then created hitboxes for them at runtime.

You will need to tag all 4 colliders with a new tag that you should create 'Melee Collider'. That ensures it uses the correct colliders

Here's the script I added, it goes in an Awake() method on my player character:
C#:
var bodyItem = InventorySystemManager.GetItemDefinition("Body");
            var attributes = bodyItem.GetAttributeList();
            foreach (var attribute in attributes)
            {
                if (attribute.Name != "Prefab") continue;
                var prefab = attribute.GetOverrideValueAsObject();
                var props = (prefab as GameObject)?.GetComponent<ThirdPersonMeleeWeaponProperties>();
                var colliders = gameObject.GetComponentsInChildren<SphereCollider>();
                if (colliders == null || props == null)
                {
                    Debug.LogError("Cannot find colliders");
                    continue;
                }

                props.Hitboxes = new MeleeWeapon.MeleeHitbox[4];
                var i = 0;
                foreach (var coll in colliders)
                {
                    if (!coll.CompareTag("Melee Collider")) continue;

                    props.Hitboxes[i] = new MeleeWeapon.MeleeHitbox(coll);
                    props.Hitboxes[i].Initialize(transform);
                    Debug.Log("Creating Melee Hitbox using collider " + coll);
                    i++;
                }
            }

It's not pretty, but it works. I also had to add a state override for the Character IK to set the hand weight to zero, after that, melee works just fine.
 
Hi again,

Your solution is working fine!

I have just update it a little bit to be able to treat also box colliders (my legs have box colliders like in the tutorial). Then I took the type <Collider> instead of sphereColliders:

var colliders = gameObject.GetComponentsInChildren<Collider>();

Thanks for your help!
 
@maaxiim & @cyril.triou -

I am looking into this now and it looks like the MeleeHitbox already has the option of using an ID. When no collider is specified it shows the Collider Object ID field which allows you to use the Object Location component, similar to the bottom of this page. Did you try this field out?

1597068330777.png
 
@Justin Nice, I didn't click on the full row initially, just the collider field, so those options didn't appear for me originally. I deleted my script and verified that they function as expected using object identifiers. Thanks!
 
Hi,

I tested by setting the ID of the collider instead of the collider object and it works fine!

I have never discovered this ID field following step by step the video. It is good to know!

Thank you Justin
 
This didn't quite work with my UMA character; things broke whenever I tried to add objects or even additional colliders on the Root structure. Since I already had placeholder empty objects (representing clothing slots) under "Items", what I ended up doing was putting Capsule Colliders (plus rigidbody set to kinematic) on those and adding a Capsule Collider Positioner script (from UCC.Character). For example, for the right hand, I used RightHand (Transform) as the first end cap and one of the fingers as the second end cap. There must be a way to get this to work within the bone structure (because UCC does this already) but if you are running into issues like I was this is an easy workaround.
 
Thanks for sharing your solution @siendel
Once we start working on the official UMA integration we'll look into this issue to see if we can come up with another solution
 
Top