|
Well, it's kind a weird problem...that I have 2 players right now. And I am setting [idlePlayer] to fade to half transparent when the [currentPlayer] touches [idlePlayer]. But here comes a problem, though the [idlePlayer] faded out, but I can not see the should be seen parts of [currentPlayer]... For example, I have a 1-meter tall P1 and a 2-meter tall P-2. and when they stand together, P-1 fades out, and right now I should have seen the whole P-2 through the half-transparent P-1, but I only see the upper part of P-2, the rest of the parts which hiding behind P-1 is invisible...like Harry Potter wearing his invisibility cloak... I am using the transparent Diffuse shader of Unity. I wander this is a shader problem...and asking for help. Thanks very much!...you know, reading this my poor English... guess I gotta improve it.
this is the problem I mentioned, you see in the left pic,we can see the human through thehalf-Alphaed robot, but in the right-pic, we can not see the whole human...
(comments are locked)
|
|
Maybe your problem is being caused by the way transparent objects are drawn: they use the render queue value to define who will be rendered first (and hidden by the other).
var baseQueue = 3001; // draw over the default transparent layer (3000)
var player1: Transform;
var player2: Transform;
var activePlayer: Transform;
function Update(){
if (activePlayer == player1){ // draw player1 over player2
player1.renderer.material.renderQueue = baseQueue+1;
player2.renderer.material.renderQueue = baseQueue;
} else { // draw player2 over player1
player1.renderer.material.renderQueue = baseQueue;
player2.renderer.material.renderQueue = baseQueue+1;
}
}
Thank you! that works perfect!!! Looks like you just showed me something that I had never seen before, guess I need to do some more study. anyway, thanks!
Mar 03 '12 at 05:13 PM
wolvtodd
(comments are locked)
|


http://en.wikipedia.org/wiki/A_picture_is_worth_a_thousand_words
Thank you.. I have added the picture of my problem and updated the question.