1
votes

I have an OOTB terrain (GameObject > 3D Object > Terrain)
    -Terrain Collider component
I have an OOTB sphere (GameObject > 3D Object > Sphere)
    -Sphere Collider component
I have this script attached to the sphere:


    void OnCollisionEnter()
    {
        // do something
    }

The sphere intersects the terrain; code does not trigger.

Why? What do I need to have them collide? I tried having the sphere hit a cube and it won't work either.

1
I take it the Sphere has a RigidBody attached? - Justin MacArthur
No it doesn't have a rigidbody attached... I don't want it to have a rigidbody... - Thunder Soul
Please review the appropriate documentation about when collisions are actually registered. The chart at the bottom should have all the information you need. (You're going to have a hard time if you don't want to use Rigidbodies at all.) - Serlite
Are you trying to have a collision or a trigger, what is the purpose of the intersection? More code would be handy. - Alan-Dean Simonds

1 Answers

1
votes

As they said in the comments, you need a Rigidbody to detect the collisions, if you don't want the object to be affected by the physics of unity just check isKinematic