Why is the FPSController's Character Controller not working as a Collider?
Hello, I was having issues with some scripts I have for "Moving Platforms/ Elevators"
I tried some different things to get this script working. One of them was, I added an additional "Capsule Collider" to the FPSController "on top of" the Character Controller, and this script now works.
public class HoldObjects : MonoBehaviour {
public GameObject thePlayer;
void OnTriggerEnter (Collider col)
{
col.transform.parent = gameObject.transform;
}
void OnTriggerExit (Collider col)
{
col.transform.parent = null;
}
}
But I know, I shouldn't have to add this "additional Capsule Collider", Right? I tried changing (Collider col) to (CharacterController cc) etc. etc. I know this is simple, but i can't get this script to work without the Capsule Collider attached to the FPSController.
Any help would be greatly appreciated! Thanks.
Answer by FortisVenaliter · Feb 10, 2017 at 10:56 PM
The "capsule" in the character controller is for visualization only. It is not an actual collider, as a character does not behave like a normal physics object. If you want those collision functions, you do need an actual collider attached to your object, as far as I know.
Thank you for your reply. So I'm doing the right thing by adding a Capsule Collider to the FPSController? I'm confused because it seemed to be correct, until it started causing issues with other colliders. For Example: If i have the Capsule Collider on the FPSController, and I enter my "Door Animation Trigger" the animations are messed up. Without the Collider, it's fine, but then the Platforms/Elevators Script doesn't work.
Well, the CharacterController is handling collisions without expecting the collider. If anything, I'd make the additional collider a trigger as well.
Your answer
Follow this Question
Related Questions
2D Character Falling Through Ground 0 Answers
Character controller going through walls? 1 Answer
Flying character rigidbody - can't see any static collider 1 Answer
How to set an object to be a child of another using c# 1 Answer
PLAYER NOT ACTIVATING TRIGGER WHEN ON TOP OF THE COLLIDER! IS THIS A BUG 0 Answers