bullet traises

Posted By: Blobfist

bullet traises - 04/14/18 18:16

Hello,

I have "bullets" using c-trace instead of an actual flying model.
However, since I am using a trace, how can I add an nice bullet trace effect, especially since the bullet (trace) will have an immediat impact. Maybe an after image or something like that?
Posted By: 3run

Re: bullet traises - 04/14/18 18:26

Hi, take a look at this wonderful example made by Superku:
[Code/ Idea] bullets without entities

Greets!
Posted By: Blobfist

Re: bullet traises - 04/14/18 22:36

3run, thats a fast reply Oo

Thank you!
Posted By: Blobfist

Re: bullet traises - 04/15/18 00:10

hmmm,

is it passable to play sounds at specific vector or traceed positions?

Code:
ent_playsound(hit,impact,100);//play impact sound from actual impact location.

OR

ent_playsound(vectorposition,impact,100);//play bullet flyby sound from current vector position

Posted By: 3run

Re: bullet traises - 04/15/18 09:39

If you want to play impact sound, simply create a dummy model at hit->x position (or target.x) and play ent_playsound at it (note that there should be a pointer to ENTITY, not vector as you've used in your example). After sound was played, remove that dummy model.

Example:
Code:
void impact(){
	
	var snd_handle = ent_playsound(my, impact_wav, 500);
	
	while(my){
		
		if(!snd_playing(snd_handle)){ break; }
		wait(1);
		
	}
	
	safe_remove(my);
	
}

// in bullet function
if(trace_hit){
	
	ent_create(NULL, &hit->x, impact);
	
}



Best regards!
© 2024 lite-C Forums