- Home /
CollisionFlags.CollidedBelow alternating value
Hello, this may be a silly question, as I'm sure everybody has gone trhu it. Thing is, I have this function:
function is_grounded() {return (collisionFlags & CollisionFlags.CollidedBelow); }
But the value it returns with my character is in fact grounded alternates between true and false wildly and rapidly. I know it might be an issue with how the automatic collision works on unity, but I still didn't find a clean and short solution to this issue. What's what works best for you?
Answer by molegato · Mar 15, 2013 at 08:23 AM
Hi! Almost forgot about this. I actually solved it some time ago by making the movement script have a default downwards movement, rather than being still in place. Since it uses a charactercontroller it can't go trough the floor, and even if the floor has an irregular surface, the character will stick to it as long as he's not basically falling off a cliff. A good value I've found is -0.75*Time.deltaTime on the y component. Learnt that and a lot of other cool stuff by reverse-ingeneering the 'FPSWalker Enhanced'
i wish i can thumb up this but the system says i have no permission. In any case thanks for shedding light on this. Your fix worked perfectly!
Your answer
Follow this Question
Related Questions
OnCollisionStay is not returning anything 1 Answer
Animation freezes on TriggerStay2D 0 Answers
Can't crash airplane into ground 4 Answers
Player rotating after wall collision 1 Answer
Best way to ignore y component for certain collisions? 1 Answer