Jump to content

Decals won't disappear


darrenc182
 Share

Recommended Posts

Decals won't disappear when freeing the entity. This use to work fine and it was the way I erased bullet decals after a certain amount of time. Does anyone know why the decals no longer disappear after the decal's entity is freed? Also is there a way to remove a decal after a certain time frame? I will post some code if needed upon request. Thanks in advance for all help and suggestions.

Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5.

Link to comment
Share on other sites

You could use/copypaste the MultiTimer class from gamelib to give each decal a decaying time, and then remove them when the time has passed.

Thanks for the reply Metatron. How do I remove the decal when the time passes. I make a call to FreeEntity when the set time expires, but that doesn't remove the decal.

Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5.

Link to comment
Share on other sites

I am setting the parent of the entity, but I'm not removing the parent until the user quits and I need the decal to disappear before then since these particular decals are bullet holes.

Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5.

Link to comment
Share on other sites

ah sorry... when you said the decal's entity in the first post i thought you meant the pick entity that it was being attached to... not the decal itself.

 

I would suggest that you post your code because i can free a decal just fine... i assume it has something to do with however you are creating an array of them...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

ah sorry... when you said the decal's entity in the first post i thought you meant the pick entity that it was being attached to... not the decal itself.

 

I would suggest that you post your code because i can free a decal just fine... i assume it has something to do with however you are creating an array of them...

 

Here is my code for creating a decal.

Decal = CreateDecal(pick.surface, TFormPoint(Vec3(pick.X,pick.Y,pick.Z), NULL, pick.entity), 1.0f, 0);
EntityParent(Decal, pick.entity);
PaintEntity(Decal, LoadMaterial("abstract::dev_decal.mat"));
UpdateMesh(Decal);
AddMesh(Decal, pick.entity);
time = AppTime();
sprintf(key, "%f", time+5000);
SetEntityKey(Decal, "killtime", key);
SetEntityCallback(Decal, (byte *)UpdateBulletDecalCallback, ENTITYCALLBACK_UPDATEPHYSICS);

 

And here is the code for freeing the decal once the specified time has been reached.

void __stdcall UpdateBulletDecalCallback(TEntity entity)
{
float time, time_value;
str key_value;

key_value = GetEntityKey(entity, "killtime");

time_value = flt(atof(key_value));

time=AppTime();

if(time>time_value)
	FreeEntity(entity);
}

Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...