Posted By: Reconnoiter
hit vertex - 01/28/15 00:40
Hi,
I want to let a projectile stick to an enemy after it hit. So I want to use hit.vertex (hit.x is not accurate enough) to get the nearest vertex and since I can't get it from a c_move collision event I use a c_trace after the c_move collision. But it doesn't pick the right vertex of the enemy, it always picks the same vertex of the enemy no matter where I hit the enemy.
Don't see why this shouldn't get the right vertex
Setting SCAN_TEXTURE for c_trace does also not seem to help.
I want to let a projectile stick to an enemy after it hit. So I want to use hit.vertex (hit.x is not accurate enough) to get the nearest vertex and since I can't get it from a c_move collision event I use a c_trace after the c_move collision. But it doesn't pick the right vertex of the enemy, it always picks the same vertex of the enemy no matter where I hit the enemy.
Code:
...projectile hits enemy through c_move... if (HIT_TARGET) { if (you) { enemy_p = you; VECTOR tmpfrom_vec, tmpto_vec; vec_set(tmpfrom_vec, vector(my.x-(20)*cos(my.tilt)*cos(my.pan),my.y-(20)*cos(my.tilt)*sin(my.pan),my.z-(20)*sin(my.tilt))); vec_set(tmpto_vec, vector(my.x+(20)*cos(my.tilt)*cos(my.pan),my.y+(20)*cos(my.tilt)*sin(my.pan),my.z+(20)*sin(my.tilt))); if(c_trace(tmpfrom_vec, tmpto_vec, IGNORE_PASSABLE | IGNORE_FLAG2) > 0) { if (you) { if (enemy_p == you) vec_for_vertex (my.x, enemy_p, hit.vertex); } } .... } } ....
Don't see why this shouldn't get the right vertex
Setting SCAN_TEXTURE for c_trace does also not seem to help.