- Home /
why isn't OnCollisionEnter called?
so in FeetScript in footmesh_R i have
void OnCollisionEnter(Collision collision)
{
Grounded = true;
...
}
but even though i drop Testingpants on a mountain oncollisionenter is never called. i have tried with breakpoint and debugger and you can see Grounded is still false in the inspector. but the physics are working there is no other collider stopping Testingpants from falling through the level.
the mountain is a static mesh collider and for the foot i have tried both convex meshcollider and boxcollider. - same result
i have now tried with 2 boxcolliders as well still no call.
Answer by TheFloatingSheep · Oct 22, 2016 at 12:20 AM
You need a rigidbody on both colliders.
Set constraints if you don't want it to jump around.
Answer by aditya007 · Oct 22, 2016 at 01:20 PM
You have Static collider on the mountain. OnCollisionEnter is for Rigid Bodies ,i.e., gameobjects which have a Rigibody Collider.
Therefore, as @TheMiningSheep said, you need Rigidbodies on both game objects.
Your answer
Follow this Question
Related Questions
House has no colliders? 2 Answers
Collider population and animation events 0 Answers
Slenderman script problem 5 Answers
physics.OverlapSphere colliders 1 Answer