Hello everybody,
We are coding a 3D side scroller game (like Trine for example).
The main character is definded by a CharacterController with a script to manage movements.
For each frame, I check if my player is grounded or not. With this information, I’m able to allow or avoid specific movement.
For instance, I can trigger a roll when I’m grounded but I can’t when I’m jumping.
Here is my IsGrounded function :
bool IsGrounded (){
bool isGroundedBool = false;
CharacterController controller = GetComponent<CharacterController>();
if ((controller.collisionFlags & CollisionFlags.Below) != 0)
isGroundedBool = true;
return isGroundedBool;
}
My problem is I have completely random output from this function.
I tried to use CharacterController.isGrounded() with the same results.
My character is moving on a Mesh Collider, a Mesh Filter and a Mesh Rendered.
Can you explain me why I have different outputs even when my CharacterController staying on the ground (no movement).
Thanks a lot ! (sorry for my awful english …)