- Home /
Collision object Under Character Controller?
Is it possible to check if an object is colliding specifically with the bottom of the character controller?
I want to store the object in a variable that the character is standing on. I don't want this to apply if the character is colliding with any other part(eg. sides or top).
Answer by Ehren · Oct 22, 2010 at 04:26 PM
You can override the function OnControllerColliderHit(hit : ControllerColliderHit) and check hit.moveDirection and hit.normal. They will indicate the direction of the character and the direction of the force the character encounters.
Another option: CharacterController.collisionFlags is updated every time you call CharacterController.Move. You could check if collisionFlags == CollisionFlags.Below.
Thanks $$anonymous$$an. That was Exactly what I needed.
Your answer
![](https://koobas.hobune.stream/wayback/20220613080450im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
First Person Controller vs. Character (Penelope Tutorial) 2 Answers
Problem with Movement Script 0 Answers
Third Person MMO Controler 2 Answers
Character movement relative to both camera and transform 2 Answers
Player Animation and control panel 2 Answers