- Home /
collision flags not playing nice with rigidbodies
So I have a cube with characterController on it, I'm building my own script for it. This player cube is sitting on a row of non-kinimatic Rigidbody cubes. I am trying to keep track of the player's state, one for when it's on the ground one for when it's jumping/in the air. I used CharacterController.collisionFlags to try and switch states. But even when the player is on the ground, it is constantly flipping between the two. Bassically I have:
if(state == 1){
if(controller.collisionFlags == CollisionFlags.None){
Debug.Log("State is now 2");
state = 2;
}
}
else if(state == 2){
if(controller.collisionFlags == CollisionFlags.Below){
Debug.Log("State is now 1");
state = 1;
}
}
Just to confirm that the physics side sees that something is there I used OnControllerColliderHit, which does see the row of cubes. So this method works but I'd rather not use it because then I have to find the points of contact.
Can any explain why CollissionFlags isn't working for me?
Your answer
Follow this Question
Related Questions
Gravity not working 1 Answer
How to make jump something without using a character contoller? 2 Answers
How can I slow Gravity 2 Answers
Character Controller and etc. 0 Answers
Applying constant force to charcter when it goes inside a trigger 1 Answer