Character stuck on wall

KO_Games

Member
In my game, my doorways have a small frame around the door entrances. If the player is running up against the wall and sliding against the wall the player gets stuck on the door frame. Is there a way to make it, so when the character is sliding up against a wall if the character runs into some small detail such as door frame it can glide over it if the detail is small enough and not get stuck? Basically, if the character is running up against a wall it will move and glide along the wall smoothly even if it hits something small such as a door frame and not get stuck by the tiny detail.
 
Right now the easiest way would probably to add a diagonal collider so the character smoothly goes across it. You could create an ability which pushing the character away from the object if they get stuck but adding the diagonal collider is probably the easiest way to solve this. Post version 2.2 I may be able to add an option that allows the character to glide across if the protruding object is less than a specified distance.
 
Thanks Justin for the response. I'll just adjust the colliders on the objects for now. If you are able to add that option, that would be excellent!
 
I asked about this before, but I just wanted to check to see if there were any updates on how to handle the issue. Basically, what happens is that the character gets stuck on very small edges from colliders on walls and objects. So then it appears like the character is running in place not being blocked by anything. For example, say you have a modular house where you join together walls. If each wall has a box collider on it then when the character runs up against the wall and reaches the next section of the wall with a new collider the character gets stuck on an invisible box collider edge.

Is there a way to make it, so when the character is sliding up against a wall if the character runs into some small detail such as door frame or a new box collider that it can glide over it if the detail is small enough and not get stuck? Ideally, if the character is running up against a wall it will move and glide along the wall smoothly even if it hits something small such as a door frame and not get stuck by the tiny detail.

 
I believe in the past this issue has been reported when the character collider's step height is equal to or larger than their radius - is that the case for you?
 
I believe in the past this issue has been reported when the character collider's step height is equal to or larger than their radius - is that the case for you?
I believe this is related to horizontal collisions rather than vertical. I merged the two threads.

@KO_Games - I have not had the chance to add this yet. The best option is still to add the diagonal collider.
 
@Justin Hi Justin, did an option ever get added in a particular version of UCC to allow gliding past a very small protruding object in the horizontal collision detection?
 
No, this will still take a separate ability for right now. I do have a fix in the next major version but that required a total rewrite of the locomotion system so I am still working on it.
 
No, this will still take a separate ability for right now. I do have a fix in the next major version but that required a total rewrite of the locomotion system so I am still working on it.

Sounds promising! I've been looking into a stop gap solution to generically improve this on the version of UCC we are using (2.2.4) in DEVOUR. In CharacterLocomotion::DeflectHorizontalCollisions() below the Debug.DrawRay of the closestRaycastHit I added in the condition:

C#:
if (Vector3.Angle(horizontalDirection.normalized, hitMoveDirection.normalized) <= 8.5f) {
    Debug.LogFormat("Ignoring a collision as its below a suitable deg diff from horiz dir and is thus to the side of the players movement, moveDistanceContribution {0}", moveDistanceContribution);
    Debug.LogFormat("Hit move distance either {0} or {1}", closestRaycastHit.distance - moveDistanceContribution - hitMoveDirection.magnitude - c_ColliderSpacing, hitMoveDirection.magnitude);
    break;
}

before any alteration of the platformIndependentMoveDirection.

I found this smoothed out walking alongside more complex walls (i.e. good example is a windy bridge) quite well. I'm sure this stop gap is in many ways completely wrong but I wonder what would be missing from this solution? Does the platformIndependentMoveDirection need to be adjusted slightly to counteract the hitMoveDirection somehow?
 
Sounds promising! I've been looking into a stop gap solution to generically improve this on the version of UCC we are using (2.2.4) in DEVOUR. In CharacterLocomotion::DeflectHorizontalCollisions() below the Debug.DrawRay of the closestRaycastHit I added in the condition:

C#:
if (Vector3.Angle(horizontalDirection.normalized, hitMoveDirection.normalized) <= 8.5f) {
    Debug.LogFormat("Ignoring a collision as its below a suitable deg diff from horiz dir and is thus to the side of the players movement, moveDistanceContribution {0}", moveDistanceContribution);
    Debug.LogFormat("Hit move distance either {0} or {1}", closestRaycastHit.distance - moveDistanceContribution - hitMoveDirection.magnitude - c_ColliderSpacing, hitMoveDirection.magnitude);
    break;
}

before any alteration of the platformIndependentMoveDirection.

I found this smoothed out walking alongside more complex walls (i.e. good example is a windy bridge) quite well. I'm sure this stop gap is in many ways completely wrong but I wonder what would be missing from this solution? Does the platformIndependentMoveDirection need to be adjusted slightly to counteract the hitMoveDirection somehow?
Thanks for this quick fix! My character was catching on any little edge of a collider. I didn't see much of an improvement at the cutoff of 8.5 degrees, but it worked really well at 40 or even 60 degrees. I'm not sure how this works, and what the side effects might be, but it seems to be working for the purposes of my game.
 
Top