Vault ground collision error

Cheo

Active member
Hello, I'm posting this in the Agility section because this issue occured with the Hang and Vault abilities, but it may be wider than that since it started with 3.0.9 which introduced a new ground detection method. Here's a video explaining the issue :


Here is the full stack trace of the error if it helps :

Code:
[Exception] ArgumentException: An item with the same key has already been added. Key: UnityEngine.RaycastHit
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert() at <5d4cbfbeb62e454f98e19b231866113e>:0

System.Collections.Generic.Dictionary`2[TKey,TValue].Add() at <5d4cbfbeb62e454f98e19b231866113e>:0

CharacterLocomotion.DetectGroundCollision() at /Opsive/UltimateCharacterController/Scripts/Character/CharacterLocomotion.cs:1190
1189:       if (m_ColliderCount > 1) {
-->1190:           m_ColliderIndexMap.Add(closestRaycastHit, colliderIndex);
1191:       }
1192:   } else {

CharacterLocomotion.UpdateCharacter() at /Opsive/UltimateCharacterController/Scripts/Character/CharacterLocomotion.cs:578
577:   // Is the character still on the ground?
-->578:   DetectGroundCollision();
580:   // Set the new position.

UltimateCharacterLocomotion.UpdateCharacter() at /Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:588
586:   }
-->588:   base.UpdateCharacter();
590:   // Update the animations.

CharacterLocomotion.Move() at /Opsive/UltimateCharacterController/Scripts/Character/CharacterLocomotion.cs:545
543:   EnableColliderCollisionLayer(false);
-->545:   UpdateCharacter();
547:   EnableColliderCollisionLayer(true);

SimulationManager+CharacterComponents.Move() at /Opsive/UltimateCharacterController/Scripts/Game/SimulationManager.cs:61
59:               Handler.GetRotationInput(horizontalMovement, forwardMovement, out deltaYaw);
60:           }
-->61:           Locomotion.Move(horizontalMovement, forwardMovement, deltaYaw);
62:       }
63:   }

SimulationManager.MoveCharacters() at /Opsive/UltimateCharacterController/Scripts/Game/SimulationManager.cs:261
259:   {
260:       for (int i = 0; i < m_Characters.Count; ++i) {
-->261:           m_Characters[i].Move(preMove);
262:       }
263:   }

SimulationManager.FixedUpdate() at /Opsive/UltimateCharacterController/Scripts/Game/SimulationManager.cs:229
227:       MoveCharacters(true);
228:       RotateCameras();
-->229:       MoveCharacters(false);
230:       MoveCameras();
231:   }

I don't know if anybody else got this error recently ? In any case I hope someone can help because I can't really make sense of it, the character's capsule collider should simply pass through the vault object while the ability is active I guess.

Edit : DankP3 tried to help me on Discord but we couldn't get to the bottom of it. One thing I should add though is that my character can perform a vault over objects that are not penetrated by others. So if I use a simplified version of the building's collider which does not contain the barriers then my character can vault over the vault object with no problem. And if I then add a long cube to replace the barriers, the issue happens again. So it's not a matter of collider complexity but simply about a collider being inside of a vault object.
Dank suggested I should use a specific layer for vault objects, but that did not prevent the error from happening and I was using Object IDs to begin with, which must have greatly reduced the detection counts.
 
Last edited:
Jesus, that was one of the weirdest errors I've stumbled upon ! It turns out that this error is for some reason linked to the presence of at least one additional character model under the main root. I'm not kidding, I've double checked in my own project and a test one, what you see here comes from the simplest scene possible in UCC 3.0.9 :


Please try and reproduce this, tell me if you get the error as well and if you do please fix it, I've just spent an afternoon to realize that I can't safely use this ability with my current multi-model character prefab !
 
Hey that error looks the same as an error I was getting in USC and why the DetectGound bool was introduced. It has also been made more generic now and is able to be changed within the ability in the inspector USC doesn't make use of the inspector value, so I can't say that I have tested it much yet. You could possibly try changing that bool. This info now actually makes this error make much more sense to me now too! I did not even think of the second character! I just knew that disabling ground detection at the right time fixed the issue I was having.
 
Bouncing on what FastSkill just said, I tried setting the DetectGround bool to false while vaulting, and it works ! Here is another video demonstrating this :


I've already said this, but damn this state system is super convenient ! So it can be used as a fix until the model issue is resolved.
 
I am having trouble reproducing this error. In the Agility demo scene I added Rhea to Atlas and then vaulted. I didn't get any errors with that second character model. Should that have triggered the error? If it's easier you can just send me the repro demo scene that you are using in your video.
 
Alright, so I just created a new fresh project to be sure and tried to recreate the same scene but the vault could be performed with no error ! I was wondering if I had tampered with something in my two previous projects, but then I copied the transform values of the cube penetrating the vault object in my previous test scene, and with that the error was thrown when trying to vault !

I'm sending you the whole new test project if is necessary, but you can simply download the scene named "VaultCollisionTest" in Assets -> Scenes and see for yourself. It containes a series of vault object penetrated by thin cubes, apparently they need to have a y value of more than 0.6 to create the error.
 
Last edited:
Thank you. For future scene requests please do not share the entire project in the forum post since not everyone who reads this has a license to the character controller.

With that said, now that I can reproduce it I'll be able to fix it for the next update :)
 
Top