x


HELP!! OnCollisionEnter is not working when i built it out on IPHONE!

i need urgent help regarding the collision detection problem i had in my game, before i exported the game into my iphone, everything is working file, including the collision detection and stuff, i even tried building it out in other platforms like PC, mac and all is working too, only unity iphone doesnt work. can anyone please tell me whats wrong?

below is my code for the collision part.

//Collision Detection between player and carrots. function OnCollisionEnter( collision : Collision ) {

if(collision.gameObject.tag == "Carrot1" && playerNo == 1 && carrotNo == 1) { Destroy(collision.gameObject); //Destroy Current Gameobject that is being touched. scores.addScore(); scores.addMultiply(); } else if(collision.gameObject.tag == "Carrot1" && playerNo == 2 && carrotNo == 2) { Destroy(collision.gameObject); scores.addScore(); scores.addMultiply(); }

 if(collision.gameObject.tag == "Carrot2" && playerNo == 1 && carrotNo2 == 1)
 {
     Destroy(collision.gameObject);
     scores.addScore();
     scores.addMultiply();
 }
 else if(collision.gameObject.tag == "Carrot2" && playerNo == 2 && carrotNo2 == 2)
 {
     Destroy(collision.gameObject);
     scores.addScore();
     scores.addMultiply();
 }

}

am i doing anything wrong? in the game itself it just doesnt seem to detect the collision.

PLEASE, any suggestion is welcome. )';

more ▼

asked Nov 16, 2010 at 04:59 AM

Avery gravatar image

Avery
29 13 11 17

Did your project build correctly ? If your project is without the UnityEngine you won't get any "PhysX"

Nov 16, 2010 at 06:27 PM Proclyon

okay, i found the problem that is affecting the whole collision, however the problem is with the GetComponent issues now.

Nov 19, 2010 at 03:01 AM Avery
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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:

x4266
x3195
x2230

asked: Nov 16, 2010 at 04:59 AM

Seen: 1183 times

Last Updated: Nov 16, 2010 at 04:59 AM