crashcat docs
    Preparing search index...

    Function setShape

    • Changes the shape of the character, checking for penetration first.

      Algorithm:

      1. Early exit if shape is the same
      2. If penetration testing enabled (maxPenDepth < MAX_VALUE): a. Test collisions with new shape in temp pool b. Reject if any contact penetrates deeper than threshold (and not sensor) c. Track contact changes: resetContactTracking, replace contacts, updateSupportingContact, finalizeContactTracking
      3. Set new shape
      4. Update inner body shape if it exists

      Parameters

      • world: World

        the physics world

      • character: KCC

        the character controller

      • newShape: Shape

        the new shape to use

      • filter: filter.Filter

        collision filter for penetration testing

      • listener: CharacterListener | undefined

        optional listener for contact callbacks

      • maxPenetrationDepth: number

        maximum allowed penetration, use Number.MAX_VALUE / Infinity to skip testing

      Returns boolean

      true if shape was changed successfully, false if blocked by penetration