Question by
Xeritan · Sep 29, 2016 at 04:22 PM ·
controllerslope
Need help with slope limitation for custom character controller
I'm trying to make it so that my character will fall when on a slope that is too steep, with this:
if (hitpos.normal.y > .707f) {
That works, but it creates a problem when jumping off of high ledges. I am able to continue jumping in mid air, as if it is considering the character grounded and falling at the same time. Any help would be greatly appreciated. I've tried many things but I'm stumped at this point. Thank you very much in advance.
void Falling()
{
RaycastHit hitpos;
if (Physics.Raycast (charCollider.bounds.center, -charTransform.up, out hitpos, 0.9f * scaleFactor, GroundLayer)) {
if (hitpos.normal.y > .707f) {
fall = false;
}
else
{
fall = true;
}
}
}
Comment