FTE:tracebox + tracebox issue
Moderator: InsideQC Admins
3 posts
• Page 1 of 1
FTE:tracebox + tracebox issue
Ok, this is weird.
If I have an entity patroling the area with tracebox/traceline (it's the same)
and it intercepts a player entity which itself has a tracebox function that makes player moves
Like so
The player is not seen! Sometimes it's seen only if player gets very near to trace_endpos origin (I use visual placeholder for trace_endpos so it's quite easy to do that), but, apart from that, player entity it's completely invisible to that trace.
If I comment the CSQC_Input_Frame() part and I simply use
And I move the player in every point of the trace, player is seen again!
I tried to use, in entity patroling function,
or
But it's the same. Even without no trace_fraction block, removing player tracebox will make player visible again.
I also thought: entity patroling think func is ticking every 0.02 second every time, CSQC_Input_Frame() is doing its job at some milliseconds per frame -> FTE doesn't understand which tracebox belongs to who. But I modified the think function to 2 sec and it's the same.
Another thought(probably the correct one): patroling entity uses CSQC_Input_Frame() too to do physics
, even if it's not a player. Probably it's not the best using CSQC_Input_Frame() for non-player entities, isn't it?
Infact, if I comment patroling entity code in CSQC_Input_Frame(), player is invisible to traceline/tracebox EVEN using simple origin placement code I explained above.
So the error could be using CSQC_Input_Frame() for non player entities physics? I don't use movetypes, because they act funny in purecsqc games, so I do physics on my own. Should I use think function to accomplish the task?
Thanks everyone in advance
If I have an entity patroling the area with tracebox/traceline (it's the same)
- Code: Select all
void Patrol()
{
makevectors(self.angles);
tracebox(self.origin+self.charSightHeight,self.mins,self.maxs,(self.origin+self.charSightHeight)+(v_forward*AI_PATROL_RADIUS),0,self);
self.charSightOrg = trace_endpos;
traceFrac = trace_fraction;
if(trace_ent.gameClass == GAME_CLASS_PLAYER){
self.awake = TRUE;
}
}
and it intercepts a player entity which itself has a tracebox function that makes player moves
Like so
- Code: Select all
void CSQC_Input_Frame()
{
if(patrol){
makevectors(patrol.angles);
tracebox(patrol.origin,patrol.mins,patrol.maxs,patrol.origin+patrol.velocity,0,patrol);
patrol.origin = trace_endpos;
}
if(player){
makevectors(input_angles);
player.velocity = v_forward;
player.velocity *= input_movevalues_x * (input_timelength * 0.3);
tracebox(player.origin,player.mins,player.maxs,player.origin+player.velocity,0,player);
player.origin = trace_endpos;
}
}
The player is not seen! Sometimes it's seen only if player gets very near to trace_endpos origin (I use visual placeholder for trace_endpos so it's quite easy to do that), but, apart from that, player entity it's completely invisible to that trace.
If I comment the CSQC_Input_Frame() part and I simply use
- Code: Select all
float CSQC_InputEvent(float evtype, float scanx, float chary, float devid)
{
switch(evtype){
//letter Q
if (scanx == 113){
player.origin_y += 32;
}
break;
}
return 0;
}
And I move the player in every point of the trace, player is seen again!
I tried to use, in entity patroling function,
- Code: Select all
if(trace_fraction < 1)
or
- Code: Select all
if(trace_fraction == 1)
But it's the same. Even without no trace_fraction block, removing player tracebox will make player visible again.
I also thought: entity patroling think func is ticking every 0.02 second every time, CSQC_Input_Frame() is doing its job at some milliseconds per frame -> FTE doesn't understand which tracebox belongs to who. But I modified the think function to 2 sec and it's the same.
Another thought(probably the correct one): patroling entity uses CSQC_Input_Frame() too to do physics
- Code: Select all
if(patrol){
makevectors(patrol.angles);
tracebox(patrol.origin,patrol.mins,patrol.maxs,patrol.origin+patrol.velocity,0,patrol);
patrol.origin = trace_endpos;
}
, even if it's not a player. Probably it's not the best using CSQC_Input_Frame() for non-player entities, isn't it?
Infact, if I comment patroling entity code in CSQC_Input_Frame(), player is invisible to traceline/tracebox EVEN using simple origin placement code I explained above.
So the error could be using CSQC_Input_Frame() for non player entities physics? I don't use movetypes, because they act funny in purecsqc games, so I do physics on my own. Should I use think function to accomplish the task?
Thanks everyone in advance
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: FTE:tracebox + tracebox issue
the engine has some collision stuff going on inside it.
if you change .solid, mins, maxs, origin, (if solid_bsp: angles, modelindex), then you MUST call setorigin/setsize/setmodel after/for that change. Failure to do so can cause the engine to fail to notice those entities for collisions and possibly findradius.
(if you're calling tracebox multiple times then you only need to call setorigin after the last of the series - self.origin is irrelevant when you're ignoring self anyway).
Additionally CSQC_Input_Frame should not be doing any actual physics, unless you want jerky motion with cl_netfps set low, and you don't want the server to see it.
Either update it each video frame (allowing for partial input frames too), or apply your input log directly in the entity update function and then interpolate in predraw (which is simpler, at least).
if you change .solid, mins, maxs, origin, (if solid_bsp: angles, modelindex), then you MUST call setorigin/setsize/setmodel after/for that change. Failure to do so can cause the engine to fail to notice those entities for collisions and possibly findradius.
(if you're calling tracebox multiple times then you only need to call setorigin after the last of the series - self.origin is irrelevant when you're ignoring self anyway).
Additionally CSQC_Input_Frame should not be doing any actual physics, unless you want jerky motion with cl_netfps set low, and you don't want the server to see it.
Either update it each video frame (allowing for partial input frames too), or apply your input log directly in the entity update function and then interpolate in predraw (which is simpler, at least).
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: FTE:tracebox + tracebox issue
Thanks a lot Spike, it worked. Sad thing is that you already warned me to call setorigin(),setsize(),setmodel() after origin/size/model change and I completely forgot about it, so I put a little remainder in my signature (I was made 10 of those links but forums rules allow only 5 links for signature..sigh)
Could you think it could be possible to make automatic this process?
Regarding putting physics in .predraw.. I can guarantee that's impossible. Once I tried and jump movements become hyper-jumps with no control. The only place where I found that physics works (for pure csqc games) is CSQC_Input_Frame() at least for now. I learned from your purecsqc mod to use it. But I noticed that even in .think functions physics should work
Could you think it could be possible to make automatic this process?
Regarding putting physics in .predraw.. I can guarantee that's impossible. Once I tried and jump movements become hyper-jumps with no control. The only place where I found that physics works (for pure csqc games) is CSQC_Input_Frame() at least for now. I learned from your purecsqc mod to use it. But I noticed that even in .think functions physics should work
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest