Posted By: Superku
weird c_trace behaviour... - 11/15/10 13:27
I have an entity that is placed before a c_trace call and afterwards I move it somewhere else so it cannot be hit by the trace.
The problem is, c_trace does not know that the entity is there when I don't use a "wait(1);" after placing the obstacle.
Without wait:
With wait:
What's wrong?
Thanks in advance!
The problem is, c_trace does not know that the entity is there when I don't use a "wait(1);" after placing the obstacle.
Without wait:
With wait:
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////
void main() {
video_mode = 11;
fps_max = 60;
level_load(NULL);
camera.x = -100;
player = ent_create(CUBE_MDL,nullvector,NULL);
set(player,POLYGON);
wait(1);
c_setminmax(player);
while(1) {
player.y = 0;
//wait(1); // <------------ !!
c_trace(vector(0,0,32),vector(0,0,-32),IGNORE_PASSABLE);
player.y = 32;
draw_line3d(vector(0,0,32),NULL,100);
if(trace_hit) {
draw_line3d(vector(0,0,32),COLOR_RED,100);
draw_line3d(vector(0,0,-32),COLOR_RED,100);
}
else {
draw_line3d(vector(0,0,32),COLOR_GREEN,100);
draw_line3d(vector(0,0,-32),COLOR_GREEN,100);
}
wait(1);
}
}
What's wrong?
Thanks in advance!