|
hi, does anybody of you know how I can do that if a gameobject (with a collider) hits an object it does something like this: if(Robot.hit(this)){ blabla(); }
(comments are locked)
|
|
Using Javascript you would do something like this: function OnTriggerEnter(otherObject: Collider){ if(otherObject.gameObject.tag == "Robot"){ blabla(); } You would also have to create a tag and name it Robot, then select that tag on the object you want to collide. Also you might have to set one of the 2 objects that are colliding to be the trigger.
(comments are locked)
|
|
This is easy, for more information visit this link: http://unity3d.com/support/documentation/ScriptReference/Collider.OnCollisionEnter.html Any questions, ask ;D Hope this help
(comments are locked)
|
|
Collider enter: function OnColliderEnter (hit : Collision) { Destroy(hit.gameObject); } Trigger enter: function OnTriggerEnter (hit : Collider) { Destroy(hit.gameObject); } thx for all these fast information...
Jun 19 '11 at 12:19 PM
bubblegumsoldier
(comments are locked)
|
