4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
c_trace and USE_BOX and collision-group problems...
#337342
08/10/10 12:40
08/10/10 12:40
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Hi all. I cant post my 'real' code here, cause its buried in some evil code. So I'll post a re-creation as close as I can.
ENTITY* bullet_template = { type="bullet.mdl"; }
function can_be_hit(VECTOR* source, ENTITY* targit, ENTITY* shape)
{
//backup old "me" info
ENTITY* old_me = me; //save old "me" so it can be restored later.
var old_my_group = my.group; //save old "me" collision group too.
me.group = 30; //set old "me" to a collision group that
// is ignored by this function
//
//backup old "targit" info
var old_targ_group = targit.group; //save "targit" collision group too.
targit.group = 30; //set "targit" to a collision group that
// is ignored by this function
//
//set "me" to collision-hull of choice
me = shape; //set "me" to collision-template for USE_BOX tracing
me.group = 30; //set "me" to ignore-able collision group
//
//do the trace. (IGNORE_PUSH should make it ignore group=30, correct?)
var results = c_trace(source, targit.x, IGNORE_PASSABLE|USE_BOX|IGNORE_PUSH);
//
//restore old "me" and "targit" to the way they were
me = old_me; //restore old me into "me"
me.group = old_me_group; //restore old "me" collision group
targit.group = old_targ_group; //restore old "targit" collision group
//
return(results); //return distance to target
}
action player_act()
{
ENTITY* victim=NULL; //pointer to selected enemy target
...
if((mouse_left)&&(victim))
{
var victim_range = can_be_hit(my.x, victim, bullet_template);
if(victim_range <= bullet_range) { shoot(); }
}
...
}
So what Im trying to do is this... I want to call a function from an action, that will 'temporarily' replace the ME with another entity in order to do a USE_BOX trace with its collision-hull, and then put it back again. And I NEED to be using the collision-groups system during the trace too, but i dont know if its working at all. Can anyone see any flaws in the program flow ? (be aware there may be some coding bugs in this un-compiled EXAMPLE code) In my real code I keep getting odd collisions with what I believe to be geometry, but its so intermittant its hard to pin down... due to the other evil code around it... Thanks guys...
Last edited by EvilSOB; 08/10/10 13:29. Reason: typo fixed 9thanks slowglider)
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: c_trace and USE_BOX and collision-group problems...
[Re: Helghast]
#337347
08/10/10 13:28
08/10/10 13:28
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Thanks guys, but no joy yet.
slowlider : Simple typo, real code doesnt have it.
Helghast : Not applicable. Fully tested. The line "me = old_me" always gets executed, which repairs any damage caused by the "me = shape".
But keep at it guys.
Hint : It is mainly the c-tracing issues Ive got the problem with...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: c_trace and USE_BOX and collision-group problems...
[Re: EvilSOB]
#337361
08/10/10 15:11
08/10/10 15:11
|
Joined: Dec 2005
Posts: 116
tD_Datura_v
Member
|
Member
Joined: Dec 2005
Posts: 116
|
Quite possibly, IGNORE_ME is almost mandatory. Also my manual (,which is out-dated,) doesn't seem to mention anything about IGNORE_PUSH working with c_trace and groups.
|
|
|
Re: c_trace and USE_BOX and collision-group problems...
[Re: tD_Datura_v]
#337363
08/10/10 15:19
08/10/10 15:19
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
Quite possibly, IGNORE_ME is almost mandatory. Also my manual (,which is out-dated,) doesn't seem to mention anything about IGNORE_PUSH working with c_trace and groups. That gave me the right idea... you should try to do c_ignore(30); before the trace, then it will ignore that group regards,
|
|
|
Re: c_trace and USE_BOX and collision-group problems...
[Re: Rei_Ayanami]
#337386
08/10/10 18:01
08/10/10 18:01
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
tD_Datura_v : Even though my example doesnt show it, I have already tried with IGNORE_ME, IGNORE_CONTENT, and both together. No change.
quote:from the manual - c_trace entry IGNORE_PUSH Ignores entities with a lower push or same group value than the given entity. For ignoring certain entity groups, call c_ignore before c_trace. TO ME "or same group value" means it ignores whatever entities have the same group-value as the me... ASSUMING that by "the given entity", it means the "me" entity.
I have also tried with the c_ignore, but I fell in the same hole as Helghast, and tried c_ignore(30); ... without the trailing zero... I'll try it again.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: c_trace and USE_BOX and collision-group problems...
[Re: EvilSOB]
#337388
08/10/10 18:11
08/10/10 18:11
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
nah. still no change...
I think I'll need to build a test project just to see whats going on...
Thanks all the same guys..
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: c_trace and USE_BOX and collision-group problems...
[Re: EvilSOB]
#337479
08/11/10 07:29
08/11/10 07:29
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
Expert
Joined: Jan 2004
Posts: 3,023
The Netherlands
|
quote:from the manual - c_trace entry IGNORE_PUSH Ignores entities with a lower push or same group value than the given entity. For ignoring certain entity groups, call c_ignore before c_trace. TO ME "or same group value" means it ignores whatever entities have the same group-value as the me... ASSUMING that by "the given entity", it means the "me" entity.
Maybe this is a bug then, or a manual mistake. I am using push values alot, and can confirm those work, but I only use them in combination with c_move not trace. good luck. regards,
|
|
|
|