- Home /
Question by
yogeshwaran · Oct 04, 2012 at 10:42 AM ·
c#javascript
change .color on contact
I'm new to unity3d.
How to change color of one object when it made contact with another object in unity,
I have error in scripting part in java script...
Comment
Answer by Griffo · Oct 04, 2012 at 10:55 AM
Something like this ..
#pragma strict
private var contact : boolean = false;
function Awake(){
}
function Start () {
}
function Update () {
if(contact){
renderer.material.color = Color.red;
}
}
function OnTriggerEnter (other : Collider){
if(other.gameObject.name == "Player"){
contact = true;
}
}
Your answer
Follow this Question
Related Questions
Rigidbody (Player) goes through wall 1 Answer
How can i add different jumping state in unity3d 1 Answer
how to use matrice with unity 3D 1 Answer
About ListItems in Unity3D 1 Answer