Decals
by Kevin Bamonte · in General Discussion · 03/30/2008 (5:47 pm) · 5 replies
Can anyone tell me how to create a decal at a specific location on the terrain ?
Thanks in advance,
Kevin
Thanks in advance,
Kevin
#2
03/31/2008 (12:55 pm)
Check the projectile code, it places decals for bullet holes
#3
i did check there along with footsteps - it will place a decal once the projectile hits an object where the projectile hits etc
but what i need to do is just put decals on the terrain at specific points - i need to set the position of the decal from script
is there any way of doing this from script ?
thanks
03/31/2008 (1:31 pm)
Thanks for the reply i did check there along with footsteps - it will place a decal once the projectile hits an object where the projectile hits etc
but what i need to do is just put decals on the terrain at specific points - i need to set the position of the decal from script
is there any way of doing this from script ?
thanks
#4
You have quite a few options for getting your decals to work. You could extend the maximum amount of textures that you are allowed to paint on your terrain, and just paint your decals on. You could hack it by modifying the projectile code; that could all be done with script but will probably be inefficient. You could also do some research into the Decal Manager that is built into torque.
Here is an old but relevant posting, though due to its age it might just throw you more off.
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2707
I think the AFX system has what you are looking for, however I do not know how their system works, and it almost certainly has engine changes involved. The player can run around painting decals on the terrain that look great, though I cannot provide any insight to their technique.
03/31/2008 (3:11 pm)
Well, it depends exactly what you are trying to do with these decals. The tricky part with getting decals to work on a terrain is the fact that terrains are rarely flat and the decals will tend to either go slightly underground or something to that effect. Bullet holes and smaller decals really aren't an issue.You have quite a few options for getting your decals to work. You could extend the maximum amount of textures that you are allowed to paint on your terrain, and just paint your decals on. You could hack it by modifying the projectile code; that could all be done with script but will probably be inefficient. You could also do some research into the Decal Manager that is built into torque.
Here is an old but relevant posting, though due to its age it might just throw you more off.
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2707
I think the AFX system has what you are looking for, however I do not know how their system works, and it almost certainly has engine changes involved. The player can run around painting decals on the terrain that look great, though I cannot provide any insight to their technique.
#5
Declare the decal:
datablock DecalData(ExplosionDecalData)
{
LifeSpan = "18000";
sizeX = 6.0;
sizeY = 6.0;
textureName = "~/data/decals/explosion";
};
Then use this on the server somewhere:
%decal = new sgDecalProjector() {
//canSaveDynamicFields = "1";
position = %position; // make sure %position is a valid variable
rotation = "1 0 0 178.945";
scale = "1 1 1";
dataBlock = "ExplosionDecalData";
};
MissionCleanup.add(%decal);
%decal.schedule(6000, "delete");
There is a bit of flicker. If anyone knows how to stop it, please let me know!
03/28/2010 (6:57 am)
This works for me!Declare the decal:
datablock DecalData(ExplosionDecalData)
{
LifeSpan = "18000";
sizeX = 6.0;
sizeY = 6.0;
textureName = "~/data/decals/explosion";
};
Then use this on the server somewhere:
%decal = new sgDecalProjector() {
//canSaveDynamicFields = "1";
position = %position; // make sure %position is a valid variable
rotation = "1 0 0 178.945";
scale = "1 1 1";
dataBlock = "ExplosionDecalData";
};
MissionCleanup.add(%decal);
%decal.schedule(6000, "delete");
There is a bit of flicker. If anyone knows how to stop it, please let me know!
Torque 3D Owner Kevin Bamonte