Home > Enterprise >  Unity Collisions
Unity Collisions

Time:03-08

I quite literally have the simplest collision set up for unity. A falling ball hits a slanted platform, and both platforms have the proper colliders, meshes etc. The code for the collision detection is as follows :

void onCollisionEnter(Collision col) { Debug.Log("Collided With" col.gameObject.name); } void onTriggerEnter(Collider other) { Debug.Log("Triggered With" other.gameObject.name); }

And it never sends anything to the debug log. I've quite literally looked at every tutorial and I have come to the conclusion that It has to be a setting bugging out. As for the components of each object, the sphere has a transform, a mesh, a sphere collider (all default), and it has a rigid body, with all default features as well and including the collision script. As for the cube, it is default of everything and includes the collision script as well. I'm so deterred by such a simple feature that I might just switch to unreal engine or hell even Roblox, surely they have better collision detection systems. Regardless, if you can, please help.

CodePudding user response:

It's OnCollisionEnter not onCollisionEnter (notice the capital O)

See Documentation for OnCollisionEnter and OnTriggerEnter

  • Related