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;
}
}
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;
}
}
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;
}
I tried to use, in entity patroling function,
Code: Select all
if(trace_fraction < 1)
Code: Select all
if(trace_fraction == 1)
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;
}
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