C-Trace

Posted By: Realspawn

C-Trace - 03/04/17 10:34

I am experimenting with c_trace. All the examples i find are those where c_trace is activate and used by a weapon.

How would it work if i want to have my player a continues c_trace above him that sticks with the player ?

many thankx for the help laugh
Posted By: painkiller

Re: C-Trace - 03/04/17 11:10

just put the c_trace on the player's action main loop and use offsets from player.x for your trace vectors
Posted By: Realspawn

Re: C-Trace - 03/04/17 11:20

Could you provide an example in the weapons it uses from weapon point to an enemy. I need more from my x to my.z + 50

thx anyway for your reaction laugh
Posted By: painkiller

Re: C-Trace - 03/04/17 12:39

something like this:

Code:
action player_action()
{
	...
	
	VECTOR from_vec,to_vec;
	var trace_dist;
	
	...
	
	
	while(me)
	{
		
		...
		
		//Set the from vector
		vec_set(from_vec,my.x);
		
		//Set the to vector
		vec_set(to_vec,vector(0,0,50)); //trace to my.z+50
		vec_rotate(to_vec,my.pan);
		vec_add(to_vec,my.x);
		
		//Trace
		trace_dist=c_trace(from_vec,to_vec,IGNORE_ME);
		
		if(trace_dist>0) //Something was hit
		{
			...
		}
		
		...
		
		wait(1);
	}
	
	...
	
}

Posted By: Realspawn

Re: C-Trace - 03/04/17 13:51

ahhhh i see. I will give it a try thx for pointing me in the right direction here laugh

Works perfect laugh thank you.
Posted By: painkiller

Re: C-Trace - 03/04/17 19:02

you're welcome wink
© 2024 lite-C Forums