Renedering issues: fading and cloaking
by Sean Brady · in Torque Game Engine · 05/14/2007 (4:30 am) · 5 replies
This script is from a simple ball shape. the shape itself has a cloak texture with the right specs and is place in the same folder as the shape.
//////////////////////////////////////////////////////
datablock StaticShapeData( healthball )
{
category = "balls";
shapeFile = "...........................";
cloakTexture = "...........................";
};
function StaticShapeData::create( %data )
{
%hball = new StaticShape()
{
datablock = %data;
}
return %hball;
}
%hball.setCloaked(true);
/////////////////////////////////////////////
this script has no errors but the shape itself doesn't cloak.
The fading capabilities are also not working when i use the same layout.
can anyone help me !!!!!!!!!
i tried posting a forum on the GPGT forum but no got back to me and that was a month ago
tanks in advance!!!!!!!!!
sean
//////////////////////////////////////////////////////
datablock StaticShapeData( healthball )
{
category = "balls";
shapeFile = "...........................";
cloakTexture = "...........................";
};
function StaticShapeData::create( %data )
{
%hball = new StaticShape()
{
datablock = %data;
}
return %hball;
}
%hball.setCloaked(true);
/////////////////////////////////////////////
this script has no errors but the shape itself doesn't cloak.
The fading capabilities are also not working when i use the same layout.
can anyone help me !!!!!!!!!
i tried posting a forum on the GPGT forum but no got back to me and that was a month ago
tanks in advance!!!!!!!!!
sean
About the author
Professional mouth!, getting projects complete is the only problem.
#2
05/14/2007 (4:38 am)
If you need to call the setCloaked() function outside of the create method you will need to establish the ID of the healthball shape.
#3
That explanation really cleans things up for thanks :)
Tanks again
Sean
05/16/2007 (9:39 am)
Sorry for offending anyone on previous forum post and cheers for the help.That explanation really cleans things up for thanks :)
Tanks again
Sean
#4
Step 1: Create and export mesh
Step 2: Go into the server scripts folder and create a script to declare your shape, eg. (healthball)
////////////////////////////////////////////////////////
datablock StaticShapeData(healthball)
{
category = "balls";
shapeFile = "...................";
};
///////////////////////////////////////////
Step 3: And just underneath that datablock declaration in the same script place the following staticshape
creation method
//////////////////////////////////////////
function StaticShapeData::create(%data)
{
%hball = new StaticShape()
{
datablock = %data;
}
%hball.startFade();
}
///////////////////////////////////////////////////////
The creation must match the staticshape creation method used by the editor to work.
(To check this go into the server/scripts folder of either the tutorial.base or demo folders. Then find the script called StaticShape.cs)
Generally the staticshape.cs is not in the tutorial.base server/scripts folder but there is no harm creating one.
If you are looking for some help as regards scripting this method just us the same one as the script in the 'demo/server/scripts' folder.
The staticshape.cs script inside the server/scripts folder doesnt match your script for the healthball word for word. The one the editor uses is just a base and then you use your own user defined one to overide it as seen with the comparison between the above healthball script and the editor staticshape script.
The reason i have a heavy emphasis on the staticshape creation is because it is the only one i know of that supports the fading and cloaking capability.
Step 4: Save the above the healthball script as healthball.cs in the same folder as the game.cs file and then place exec("healthball.cs"); in the game.cs in the server folder with similar looking code. It's about half way down.
Step 5: Once completed and both scripts are saved, run torque and go into mission editor and place your new healthball staticshape from the 'balls' category and your shape should fade.
For any info on various methods and functions go to;
http://tdn.garagegames.com/wiki/Torque_Console_Objects_9
This is sean, if anyone needs help give us a shout on the forums or by email.
Good Luck
02/14/2008 (6:38 am)
Basic Fading Tutorial for scene object [b]Step 1: Create and export mesh
Step 2: Go into the server scripts folder and create a script to declare your shape, eg. (healthball)
////////////////////////////////////////////////////////
datablock StaticShapeData(healthball)
{
category = "balls";
shapeFile = "...................";
};
///////////////////////////////////////////
Step 3: And just underneath that datablock declaration in the same script place the following staticshape
creation method
//////////////////////////////////////////
function StaticShapeData::create(%data)
{
%hball = new StaticShape()
{
datablock = %data;
}
%hball.startFade();
}
///////////////////////////////////////////////////////
The creation must match the staticshape creation method used by the editor to work.
(To check this go into the server/scripts folder of either the tutorial.base or demo folders. Then find the script called StaticShape.cs)
Generally the staticshape.cs is not in the tutorial.base server/scripts folder but there is no harm creating one.
If you are looking for some help as regards scripting this method just us the same one as the script in the 'demo/server/scripts' folder.
The staticshape.cs script inside the server/scripts folder doesnt match your script for the healthball word for word. The one the editor uses is just a base and then you use your own user defined one to overide it as seen with the comparison between the above healthball script and the editor staticshape script.
The reason i have a heavy emphasis on the staticshape creation is because it is the only one i know of that supports the fading and cloaking capability.
Step 4: Save the above the healthball script as healthball.cs in the same folder as the game.cs file and then place exec("healthball.cs"); in the game.cs in the server folder with similar looking code. It's about half way down.
Step 5: Once completed and both scripts are saved, run torque and go into mission editor and place your new healthball staticshape from the 'balls' category and your shape should fade.
For any info on various methods and functions go to;
http://tdn.garagegames.com/wiki/Torque_Console_Objects_9
This is sean, if anyone needs help give us a shout on the forums or by email.
Good Luck
#5
02/14/2008 (6:39 am)
Cloaking tut will be coming soon
Torque Owner Tim Heldna
datablock StaticShapeData(healthball) { category = "balls"; shapeFile = "..........................."; cloakTexture = "..........................."; }; function StaticShapeData::create( %data ) { %hball = new StaticShape() { datablock = %data; } return %hball; } [b]%hball.setCloaked(true);[/b]Now, take a look at that last line which I marked in bold.%hball is a local variable and you've called it outside of the function that it's declared in. To the engine, it's going to = 0. This is why your code is not working.
Try:
datablock StaticShapeData(healthball) { category = "balls"; shapeFile = "..........................."; cloakTexture = "..........................."; }; function StaticShapeData::create( %data ) { %hball = new StaticShape() { datablock = %data; } %hball.setCloaked(true); }