Correct capsule collider when jumping and landing

Cheo

Active member
Hello, here is an issue that is quite annoying for anyone working on a platormer. By default, when a character is jumping the Capsule Collider Positioner leaves a gap between the character's feet and the bottom of the collider, as the base of the model is used as the first cap. When leaving things like this, making a platformer becomes nearly impossible as obvious collision issues appear. My personal method for fixig this produced uneven results - by giving another transform the Y value of one of the character's feet and using the OnCharacterGround event to switch the first cap, the collider becomes a bit more correct when jumping, but suffers from some jitter when landing due to it clipping through the ground for a few frames. Here is a video showing all of this a bit more in detail :


As I say in the video, this issue is visible in the demo scene, and we should have an example of how to handle this issue. Once again, this is a serious issue even for some simple platforming, and as such a fix example would be warranted. Thanks in advance.
 
I just realized at the moment of posting this that UCC's animations may be contributing to this issue. Here's one example of an animation with the character above the origin point :

Capture d’écran (2332).png

I really gotta go to bed now though, maybe I'll tinker with this tomorrow. Still, if this can indeed be fixed through some animation changes, this should then be done for us if you don't mind. Thanks.
 
By default the Capsule Collider Positioner will extend from the pivot location to the top endcap (which is normally the head). If you want the collider to always match the feet location you could add a new reference bone to the animations that it follows instead of the pivot location.
 
Here's a new video in which I removed the offset from the mid air jump animation and set it as based upon the feet :


As you can see the capsule collider adjustment is a bit more correct, but the character now ends up moving the upper part of his body down instead of raising and folding his legs, which is feels off and unrealistic.

I'm asking once again for an example here and insisting that we can't have that issue on a demo character, as it causes some fundamental incoherences for basic plaforming, you can for example get the character stuck when trying to move forward onto an obstacle :


Capture d’écran (2382).png
 
All of the animations included in the controller are demo animations and are not geared towards a specific genre. For a no code solution I recommend adding a new reference bone to all of the animations that allow the capsule collider to snap to the bottom. This is instead of referencing a foot bone as you will get the results from your video. We will not be updating the animations with this.

Another alternative is that you can add an animation curve to the animations and then create a new component similar to the Capsule Collider Positioner that reads this curve and adjusts the collider based on the curve properties. This is a feature request that I can add but it will be awhile before I can get to it.
 
Hi, sorry but I'm not sure exactly what you mean by reference bone, I haven't seen that option in Unity. Do you suggest we take the animation in Blender and add a bone that is used as the pivot ?

The Sub Character trigger fix you helped me achieve today solved an issue I was otherwise relying on this main collider to handle, but I think I'll give a shot at subclassing the Capsule Collider Positioner myself. Still, making it able to read curves is definitely a feature that it would be nice to have out of the box.
 
Do you suggest we take the animation in Blender and add a bone that is used as the pivot ?
Yes, that's correct. I forgot where we use this method but I believe that at one point we used it for the agility or climbing pack. This method will ensure the collider is always exactly where you want it to be.
 
Top