- Home /
How do I change variables at collision with Player? Please Help.
How do I change variables, when the player collides with an object. I want to make if the player collides with an item, then the variable FireRate of the cannon changes. Can you help me, please?
Comment
Answer by MileSplit · Jun 08, 2014 at 01:04 PM
//C#
public void OnCollisionEnter(Collision col){
if(col.gameObject.CompareTag("Item"))
firerate = 10;
}
//Javascript
function OnTriggerEnter (col : Collider) {
if(col.gameObject.CompareTag("Item"))
firerate = 10;
}
Have a great day!
Sigh..
There's no JAVA! It's not a Unity compatible language!