using c_trace ??

Posted By: dracula

using c_trace ?? - 01/31/09 20:34

c_trace ( my.pan, enemy.x, IGNORE_ME|IGNORE_PASSABLE|ACTIVATE_SHOOT );

1. Why *does* the above compile when enemy.x isn't a vector (out of curiosiy) ?

2. What I am trying to learn is how to get my model to c_trace a static model. When I pan my model, it hits the target regardless of its pan .

action shooter()
{

while(1)
{

vessel.y += 15 * (key_d-key_a) * time_step;
vessel.x += 15 * (key_w-key_s) * time_step;
vessel.pan += 10 * (key_z-key_x) * time_step;

wait(1);

if(key_c)
c_trace ( vessel.pan, enemy.x, IGNORE_ME|IGNORE_PASSABLE|ACTIVATE_SHOOT );
wait(1);
}

}

To sum up, I can't target my enemy, I alway hit it ?

thanks

drac
Posted By: Blade280891

Re: using c_trace ?? - 01/31/09 20:47

try doing

vector(enemy.x) ?
Posted By: dracula

Re: using c_trace ?? - 02/01/09 09:23

Actually, the above code is working. What I can't do, is to send the c_trace beam directly in front of the model. I always hit the target regardless of my pan position. I have proved this by drawing a line between the model and the target.
Any ideas please ?

Thanks
Posted By: EvilSOB

Re: using c_trace ?? - 02/01/09 09:43

Because c_trace checks between two POINTS, so pan angle is immaterial.

Try using looking into using C_SCAN instead of c_trace.
I cant help much with that cause I have BAAAD vrctor skills.
Posted By: Spirit

Re: using c_trace ?? - 02/01/09 15:21

But your code cant work at all because youre confusing an angle with a position?

"pan" is an angle, which is how you rotate something. You can not put a point at an angle. You can put a point at a position. So its c_trace(my.x.. and not c_trace(my.pan..., hope this helps.

For hitting not an enemy but an imaginary point in front of the model just use:

VECTOR imaginarypoint;
vec_for_angle(imaginarypoint,my.pan);
vec_scale(imaginarypoint,1000);
vec_add(imaginarypoint,my.x);
c_trace(my.x,imaginarypoint,.....);

Posted By: dracula

Re: using c_trace ?? - 02/01/09 15:35

Hi Spirit

What you suggested works, thanks.

Thanks


© 2023 lite-C Forums