Hi,
i´ll make it short. I have a 3rd Person View. I can see my player from behind and i have a crosshair. I´m aiming with the crosshair und tracing from camera to the crosshair. It works fine so far.
If the player starts to shoot i´m tracing from the players gun to the camera´s trace target to check if there´s something between.
but the problem now is. sometimes the trace doesnt hit. I think it because it stop before the target.
Now i want to know if i can increase my Vector that the camera trace target is pushed a few quants behind it´s trace so that my player´s tracing for example into the wall.
This is my camera trace code.
VECTOR to;
vec_set(to, mouse_dir3d);
vec_scale(to, 5000); // set a range
vec_add(to, camera.x);
c_trace(camera.x, to, IGNORE_PASSABLE); // Trace from cam
vec_set(camera_target, hit.x); // save the target
And this is my player trace code.
vec_for_vertex(muendung, player, 508); // Weapon Muzzle
c_trace(muendung, camera_target, IGNORE_PASSABLE); // trace from muzzle to target
if(trace_hit)
{
you.health -= integer(random(25))+80;
ent_create(einschussloch,hit.x,einschuss); // create bullet hole
leuchtgeschoss(muendung); // another function
}
I tried to vec_scale and vec_normalize my camera_target but i dont get it. ANy help please?
Thank you