0

By default, it seems PhysX sets the "friction" on your feet to infinity, so that calling move with a downwards force (like gravity) doesn't cause you to slide down when standing on a sloped surface.

That's exactly the opposite of what I want though. I know of PxControllerNonWalkableMode::ePREVENT_CLIMBING_AND_FORCE_SLIDING, but that doesn't seem to use any sort of gravity or acceleration, and I'm not using the built-in slopeLimit value. There's also setPreventVerticalSlidingAgainstCeiling(), so it seems kind of odd that something similar wouldn't exist for the floor.

So, is there any built-in way to disable this artificial friction, and allow sliding vertically in the same way the CCT can slide along walls and ceilings? And if not, how could I generate a new downward movement vector that follows the surface normal? I'm pretty terrible at anything related to math, so (psuedo-)code examples would be appreciated.

henkle
  • 1

1 Answers1

0

Turns out I can't read, and the answer to my problem was right in the SDK Guide.

I simply had to implement a PxControllerBehaviorCallback, and have it return PxControllerBehaviorFlag::eCCT_SLIDE for each function.

    virtual physx::PxControllerBehaviorFlags getBehaviorFlags(const physx::PxShape& shape, const physx::PxActor& actor) {
        return physx::PxControllerBehaviorFlag::eCCT_SLIDE;
    }

    virtual physx::PxControllerBehaviorFlags getBehaviorFlags(const physx::PxController& controller) {
        return physx::PxControllerBehaviorFlag::eCCT_SLIDE;
    }

    virtual physx::PxControllerBehaviorFlags getBehaviorFlags(const physx::PxObstacle& obstacle) {
        return physx::PxControllerBehaviorFlag::eCCT_SLIDE;
    }

then set PxControllerDesc->behaviorCallback to an instance of my PxControllerBehaviorCallback class.

henkle
  • 1