Game Development Community

How to do real-time transparency?

by Michael Layfield · in Torque Game Engine · 07/23/2005 (5:26 am) · 4 replies

How do you do real-time transparency in TGE?

Like for example: whenever the character walks through another dts object/character, that dts then becomes transparent.

I tried searching in the forums and all I found was transparency in 3DStudiomax/maya/etc.

#1
07/23/2005 (8:41 am)
Hello,

I could be misunderstanding you, but if you're wanting to do an "all-the-way" fade out based on player location, then probably the easiest way would be to use a set of trigger scripts to schedule a fade event for whatever object (s) you want to "disappear". The scripts could work for on-enter, while-in, and on-exit.

Here is an example of the scripts I use to fade players in and out . . .

function serverCmdHidePlayer(%client)
{
         %client.player.schedule(1, "startFade", 2000, 0, true); 
}


function serverCmdShowPlayer(%client)
{
        %client.player.schedule(1, "startFade", 3000, 0, False);     
}

You will want to change the object of the fade events to whatever you want to hide, but hopefully this will get you started. You can accomplish this in other ways, but scheduling it works great for me. By the way, the 1 after the ( determines how long to wait before starting the fade effect, the 3000 tells Torque to gradually fade for 3000 milliseconds (or 3 seconds :)) and the "true" or "false" determines if the fade will make your stuff disappear or appear.

As for using triggers, I could try to explain, but it might be better for you to look at Kevin Harris' codesampler.com Torque tutorials for that. He has an entire section devoted to working with triggers. Very cool stuff.

Here's the link . . .

www.codesampler.com/torque.htm

And, for further reading, you can check out this link . . .

Forum Thread: www.garagegames.com/mg/forums/result.thread.php?qt=32533

I hope that helps. If I misunderstood what you wanted, let me know and I'll see if I can help.

Aaron E.
#2
07/24/2005 (7:14 am)
No no, this is exactly what I'm looking for, thanks a lot! :)

Oh btw Aaron before I go about starting a new thread, you wouldn't happen to know how to manipulate character position in TGE would you? Cuz I'm actually trying to make a simple sidescroller/latformer but I can't seem to find the script which affects where the character is facing.
#3
07/24/2005 (2:46 pm)
Rainier,

I'm glad that worked for you.

Hmm. Interesting question about player direction. I've never tried anything like that, but it's definitely possible. There's probably a dozen different scripting/coding ways to do it, but one artist option might be to change the location and rotation of the cam node when you're building your character's .DTS shape. But to do it that way, you will need to build your character in Max/MilkShape/gameSpace or use a pre-fab character from one of the content packs (in Max or Milkshape). If you're comfortable with those kinds of programs, it should be very easy to set up.

Since I'm mostly clueless about scripting, the art-only way described above is probably how I would approach the problem. Maybe someone else on the boards can describe a more geeky way to do it. :)

Aaron E.




[edit: some typos]
#4
07/25/2005 (9:06 am)
@Rainier
Not 100% sure if this is the answer you were looking for but you can set the characters position and orientation by calling the setTransform method on the player.