2 registered members (AndrewAMD, juanex),
1,247
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
hit vertex
#448297
01/28/15 00:40
01/28/15 00:40
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
OP
Serious User
|
OP
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
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.
...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.
|
|
|
Re: hit vertex
[Re: Reconnoiter]
#448305
01/28/15 10:45
01/28/15 10:45
|
Joined: Mar 2011
Posts: 3,150 Budapest
sivan
Expert
|
Expert
Joined: Mar 2011
Posts: 3,150
Budapest
|
due to manual you must use SCAN_TEXTURE to get the vertex data, and imo IGNORE_ME too, because you use the me entity. and I normally use IGNORE_CONTENT.
but you use wrongly vec_for_vertex, the 3rd parameter is the vertex number, not the vertex struct
Last edited by sivan; 01/28/15 10:49.
|
|
|
Re: hit vertex
[Re: sivan]
#448313
01/28/15 17:09
01/28/15 17:09
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
OP
Serious User
|
OP
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
huh but the manual says this about hit vertex : hit.vertex Vertex number closest to the contact. Can also be used to determine the hit limb of a bones animated model through the ent_bonename function.
Do I need to use ent_getvertex or something like that?
|
|
|
Re: hit vertex
[Re: Ch40zzC0d3r]
#448315
01/28/15 19:10
01/28/15 19:10
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
OP
Serious User
|
OP
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Thanks for taking the time. I use ignore_me in the c_trace now as Sivan suggested but it has the same error. I have added 'you = NULL;' for testing purposes:
you = NULL;
if(c_trace(tmpfrom_vec, tmpto_vec, IGNORE_PASSABLE | IGNORE_FLAG2 | IGNORE_ME | IGNORE_CONTENT | SCAN_TEXTURE) > 0)
{
if (you)
{
if (enemy_p == you)
{
vec_for_vertex (my.x, you, hit.vertex);
debug_var1 = hit.vertex;
}
}
}
The debug var shows always 39 (within my interface while loop: DEBUG_VAR(debug_var1, 400); ). Also the arrow is moved to some vertex (probably to 39, cause I have checked vertex 39 in the model editor and it seems to match the location). Also tried 'ent_remove(you);' and that works so the you is valid. Same goes for 'ent_remove(my);' so my is also valid. So I must be doing something wrong with hit.vertex., vec_for_vertex itself seems to be working right.
Last edited by Reconnoiter; 01/28/15 19:13.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|