IronWarrior / SuperCharacterController

Unity custom character controller

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Slope limit no longer working + jittery movement against meshes

Metamate opened this issue · comments

Bug introduced in commit "Fixed issue where SimulateSphereCast would cause controller to snap to ground off a ledge":

Changing Physics.Raycast to Physics.SphereCast in "SimulateSphereCast" has made slope limit no longer prevent character from moving up steep slopes, along with introducing "jittery" movement when running against more complex meshes,

The update correctly fixes the snap to ground issue, but unfortunately ledge-movement suffers heavily from the fix.

Hey, looked into this. Not entirely sure what the cause is, but given the increasing complexity of the grounding method it might be time for me to move on to a new algorithm. Reverting to Raycast did fix it, so I'm guessing it's some sort of precision error caused by not properly removing one of the Tolerance/TinyTolerance values.

Unity's SphereCast doesn't retrieve individual planes of contact, just the object hit and where it was hit. This is unfortunate when you're trying to retrieve multiple polygons that your character is standing on, resulting in the mess that ProbeGround is today...which means it might be time to write a custom SphereCast method!

Will look into a quick fix for this, if not will have to find another solution.

Hi, so I'm using a part of the super controller in my own character controller (the ground detection actually). It's based on a rigidbody and a capsule collider. I had a shacking problem caused by the clamping and SimulateSphereCast. The distance returned by SimulateSphereCast was negative so the controller was climbing (and falling with gravity).

I might be wrong but, so far all my tests confirmed that hit.distance represent the distance between the origin point and the center of the sphere at arrival. So hit.distance -= Tolerance is not totally accurate in that case. Adding hit.distance += TinyTolerance; (so the radius of the spherecast), fixed the problem in my case (even if I completely changed the clamping system right after that >.>).

Hope this can help =o

(sorry for my english)

Your english is actually quite good, so no worries there. I'll look into your changes, but the grounding method at this point is overly bloated and complex. I'll probably switch to something simpler using the BSPTree to grab grounded points.

commented

Has anyone found a fix for the ledge-movement bug? My controller randomly ignores the height between two plaftorms. It just snaps from the edge of the upper ground to the ground under it instead of falling.