I want to implement a function like that: when one spriteA touch other spriteB, spriteB changed its color, and do not need the collision effect, instead, the spriteA should be displayed over spriteB. How can I set parameters for the two sprites? Thanks a lot!
Set your colliders as triggers, and then use OnTriggerEnter, OnTriggerExit etc.:
http://unity3d.com/learn/tutorials/modules/beginner/physics/colliders-as-triggers
Add a collider (your choice) and click on the "Is trigger " checkbox. This insures that the collision effect is identified but without the effects of a collision i.e physics. So on your script use the following
function OnTriggerEnter(col : collider){
enter your code here
}
You can also use the
function OnTriggerExit(col : collider){
enter your code here to behave when exiting the collider
}
i hope this helps
Yes, That really works. Thanks!