- Home /
Object Collision PLEASE HELP!!!
ok this is a very noobish question probably but no matter what i do i cant get collision to work in unity.
i'm using the Platform controller in unity and i made these platforms which when my character jumps on them they detect a collision and run a function. i want these platforms to be solid so using onTriggerEnter doesn't work because my player fall though them and i cant get on collisionEnter to work either.
Any help would be good.
ps ive look at all the unity collision help on their website and i still am having problems.
Answer by Meltdown · Mar 19, 2011 at 09:00 AM
Make sure they are not marked as 'isTrigger' else they will not collide. onTriggerEnter and isTrigger are used for invisible triggers.
So removing the isTrigger should solve your issue, then add a mesh or a box collider to each platform. Then use onCollisionEnter to detect if something hit the platform.
it still wont work :( i have this code attached to the platform function OnCollisionEnter(){ Debug.Log("Hit"); } just to see if it detects it and it doesn't none of my object have isTrigger clicked and they both have colliders ( one sphere and one box)
Hmmm strange, sounds like something is definately missing. What I would do in your situation is do the 3rd person platformer tutorial. And pay special attention to the part where the colliders etc are setup, also take a look at the character properties and the collision parts of the script, you'll most likely spot something there that you missed!
http://unity3d.com/support/resources/tutorials/3d-platform-game
Good luck
im using the 2d platform controller, if that makes any difference