- Home /
Checking if the two colliding objects have the same RGBA settings
I can't seem to find the answer to this question on the forums or on tutorials... so was hoping someone could help...
I would like to create and if/else statement after collision - - in JavaScript
If the two colliding objects (wall and player) have the same RGBA values then execute function 1
If the two colliding object have different RGBA values then execute function 2.
Would be grateful for a pointer
Cheers
Answer by Seth-Bergman · Jul 23, 2013 at 11:02 PM
use renderer.material.color:
http://docs.unity3d.com/Documentation/ScriptReference/Material-color.html
if(objectA.renderer.material.color == objectb.renderer.material.color){
//1 thing
}
else{
//other thing
}
etc...
this should work I believe
Bingo, I has it off by a missing =
Thanks once again Seth!
Your answer
Follow this Question
Related Questions
How can i get my game to detect a collision? 1 Answer
Collision not working. 1 Answer
little problem with java script 1 Answer
Sound plays with step js script 0 Answers
On collision load level 0 Answers