Disabling or Removing CharacterController or Collider?

When my AI character dies, I’d like to remove the CharacterController, or at least disable it or it’s collider. CharacterController.enabled doesn’t exist, and I don’t have access to the collider that the CharacterController creates. Currently, my AI class requires the CharacterController, so I can’t Destroy it. (But other posts seem to say this causes an error if you do it anyway).

Right now it’s a problem because the collider is still blocking movement in the world, a giant invisible capsule where a dead orc’s body is. But I’d like to replace the capsule collider with a mesh collider after death, so clicking on the corpse is more accurate.

How have people handled this?

For me, if I’m understanding you correctly, you want to change it in the editor. For me, I probably do it the hard way.

For all scripts that have:

@script RequireComponent (CharacterMotor)

Text is by:

//@script RequireComponent (CharacterMotor)

Then delete CharacterMotor from the GameObject, and replace it later.

Yes, removing the requirement seems to be the only way to go. Just means I’ll need to remember to manually add the controller. Thanks

You could always just create the controller. It is nothing but a raycast downward, a linecast to where you want to be, and then another raycast downard at whatever that point is. You could get all dandy and use a spherecastall to see if you could really fit in the space.