x


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.

more ▼

asked Mar 19, 2011 at 08:39 AM

Chris 35 gravatar image

Chris 35
86 38 27 34

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Mar 19, 2011 at 09:00 AM

Meltdown gravatar image

Meltdown
6.4k 52 55 81

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)

Mar 19, 2011 at 09:18 AM Chris 35

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

Mar 19, 2011 at 10:48 AM Meltdown

im using the 2d platform controller, if that makes any difference

Mar 19, 2011 at 11:11 AM Chris 35
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5971
x4078
x2845

asked: Mar 19, 2011 at 08:39 AM

Seen: 1677 times

Last Updated: Mar 19, 2011 at 08:44 AM