ent_decal and manually setting hit struct

Posted By: Reconnoiter

ent_decal and manually setting hit struct - 01/29/18 18:08

Howdy,

With ent_decal I want to place decals without doing a c_trace before it. According to the manual you can manually set the hit.x(yz), hit.nx(yz) and hit.model = NULL and it should work. For me it doesn't though (I don't seem them anywhere), I guess I am setting hit.nx wrongly but I am not sure. (Also if I do it with a c_trace it does work so I am setting some of the hit struct wrongly.)

Code:
hit.model = NULL;
		debug_var1 = hit.x; //correct coordinates
		debug_var2 = hit.y;
		debug_var3 = hit.z;
		vec_set(hit.nx, hit.x);
		vec_normalize(hit.nx, 1);
		PARTICLE* p = ent_decal(ent, _bmap, _size, _rot); 
		p.lifespan = _time;



Ty for taking the time!
Posted By: Reconnoiter

Re: ent_decal and manually setting hit struct - 02/01/18 10:46

Anyone got an example where it works for them?
Posted By: Ayumi

Re: ent_decal and manually setting hit struct - 02/01/18 16:43



Code:
action SetDecal()
{
	hit.model = NULL;
	vec_set(hit.x, vector(-7059, 3087,595));
	vec_set(hit.nx, vector(-0,-1,0));

	BMAP* bmp = bmap_create("HoleGuns.dds");
	PARTICLE* p = ent_decal(me, bmp, 0, hit.nx); 
	p.lifespan = 10000;
	
}

Posted By: Reconnoiter

Re: ent_decal and manually setting hit struct - 02/05/18 20:40

Hi Ayumi, thanks for the example. I found out that my problem was that I didn't properly set hit.x. Eg with some models setting hit.x(yz) to my.x(yz) doesn't show the bmap but for some models it does, probably because there isn't a vertice at that exact position or such). And than I tried the hit.x(yz) from a c_trace with USE_BOX which never worked for me (maybe cause the hit.x pos is to far away from the hit.entity/model). I think I will try the pos of the nearest vertex to the hit.x for a proper hit.x.
© 2024 lite-C Forums