6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood),
1,268
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: getting bone name hit by c_trace with USE_BOX
[Re: Reconnoiter]
#470302
01/07/18 19:37
01/07/18 19:37
|
Joined: Jul 2008
Posts: 2,107 Germany
rayp
X
|
X
Joined: Jul 2008
Posts: 2,107
Germany
|
Just tryed. With the following code i receive a bone handle...have to mention i did not check whats in the handle
#define health skill100
void test_trace(){
draw_text ("active", 10,10, vector(255,0,0));
var sight = 300; // i can see this far
VECTOR tpos;
vec_for_angle (tpos, vector (my.pan, my.tilt, my.roll));
vec_scale (tpos, sight);
vec_add (tpos, vector (my.x, my.y, my.z));
trace_mode = IGNORE_ME | IGNORE_PASSABLE | USE_BOX | SCAN_TEXTURE | IGNORE_SPRITES;
c_ignore (1, 0);
c_trace (vector (my.x, my.y, my.z), tpos, trace_mode);
if (HIT_TARGET){
if (you) if (ent_bonename (you, NULL, hit.vertex)) draw_text ("Bone handle returned", 10, 20, vector (255,0,0));
draw_point3d (target.x,vector(50,50,255),100,3);
}
}
action hero{
my.health = 100;
my.group = 1;
...
..
.
while (my.health > 0){
test_trace();
...
..
.
wait (1);
}
.
..
...
}
The traced model has POLYGON flag set.
Acknex umgibt uns...zwischen Dir, mir, dem Stein dort... "Hey Griswold ... where u gonna put a tree that big ?" 1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected rayp.flags |= UNTOUCHABLE;
|
|
|
Re: getting bone name hit by c_trace with USE_BOX
[Re: rayp]
#470319
01/08/18 13:07
01/08/18 13:07
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
OP
Serious User
|
OP
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Ty for fast reply. Well the problem is that it returns the same bone name when hitting different parts/bones (polygon hulls), the manual also states that usebox is mutually exclusive with scantexture. I really need usebox though, since the entities have some thin shapes etc otherwise attacking would be to annoying.
Edit- I noticed that hit.x is actually updated, but the vertex number not. And "var vertex_num = ent_nextvertex(you, hit.x);" works only for terrains it seems. So I just need to find an effective way of finding the closest vertex to the hit.x ...
Last edited by Reconnoiter; 01/08/18 14:27.
|
|
|
Re: getting bone name hit by c_trace with USE_BOX
[Re: DriftWood]
#470335
01/08/18 20:26
01/08/18 20:26
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Thanks for the recommendation but I advise against using that old multiple boxes approach. You could use a very low poly character for collision only but with the same bones/ skeleton. When you call your hitscan weapon code copy the animation to the invisible low poly mesh, call c_updatehull (?) and c_trace without USE_BOX. I once wrote the following anim copy function, could be optimized probably:
void ent_anim_copy(ENTITY* eTarget, ENTITY* eSource)
{
int i,numBones,hparent;
ANGLE angle,angle2,angle3,eSourcePanInv;
numBones = ent_bones(eSource);
ent_bonereset_all(eTarget);
ang_diff(&eSourcePanInv,nullvector,&(eSource->pan));
for(i = 0; i < numBones; i++)
{
ang_for_bone(&angle,eSource,i+1); // use bone handles/ indices instead of names
ang_add(&angle,&eSourcePanInv);
hparent = ent_boneparent(eSource,NULL,i+1);
if(hparent > 0)
{
ang_for_bone(&angle2,eSource,hparent); // eTarget's bone is already rotated by parent bone's rotation => undo it!
ang_add(&angle2,&eSourcePanInv);
ang_diff(&angle3,nullvector,&angle2); // best way to do this? I doubt it.
ang_add(&angle,&angle3);
}
ent_bonerotate(eTarget,i+1,&angle);
}
}
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: getting bone name hit by c_trace with USE_BOX
[Re: Reconnoiter]
#470375
01/10/18 17:42
01/10/18 17:42
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Scantexture does not work with usebox i think. Hey It works for me pretty well!
|
|
|
Re: getting bone name hit by c_trace with USE_BOX
[Re: Superku]
#470392
01/11/18 13:05
01/11/18 13:05
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
OP
Serious User
|
OP
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Thanks for you all replying. Thanks for the recommendation but I advise against using that old multiple boxes approach. You could use a very low poly character for collision only but with the same bones/ skeleton. When you call your hitscan weapon code copy the animation to the invisible low poly mesh, call c_updatehull (?) and c_trace without USE_BOX. I once wrote the following anim copy function, could be optimized probably:
void ent_anim_copy(ENTITY* eTarget, ENTITY* eSource)
{
int i,numBones,hparent;
ANGLE angle,angle2,angle3,eSourcePanInv;
numBones = ent_bones(eSource);
ent_bonereset_all(eTarget);
ang_diff(&eSourcePanInv,nullvector,&(eSource->pan));
for(i = 0; i < numBones; i++)
{
ang_for_bone(&angle,eSource,i+1); // use bone handles/ indices instead of names
ang_add(&angle,&eSourcePanInv);
hparent = ent_boneparent(eSource,NULL,i+1);
if(hparent > 0)
{
ang_for_bone(&angle2,eSource,hparent); // eTarget's bone is already rotated by parent bone's rotation => undo it!
ang_add(&angle2,&eSourcePanInv);
ang_diff(&angle3,nullvector,&angle2); // best way to do this? I doubt it.
ang_add(&angle,&angle3);
}
ent_bonerotate(eTarget,i+1,&angle);
}
}
, interesting idea, will have to think a bit about this one (in combination with painting gore / decals etc that I currently use on my current trace). Scantexture does not work with usebox i think. Hey It works for me pretty well! , for me it definitely doesn't work, it keeps returning the same bonename regardless of where the target entity is hit. Edit I once simply checked height of hit to decide if leg body or head was hit to use three different anims. Of course this weak system visually cant compare to hit detection with ragdoll but it was easy fast and looked pretty cool , tnx I thought of something similar and I think it could work pretty decently as a lite limb detection system. :-) The solution is like Superku first hitbox design. He attached many invisible boxes to the model. You can make the boxes thicker on your thin body parts. When shooting you ignore the bbox of the entity and use these hitboxes. It can be found in an old AUM. Furthermore, you can use the poly of the entity and only add these hitboxes for the thin parts of the entity body. , tnx but this would become a bit complicated in my case since I have quite a bit of different models (and of various shapes). In the latter case of adding boxes to the models, I tried this earlier but it gives some problems with painting gore / decals etc on the target entities.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|