I programed some event function but there is some problem about ray trace.
Actually, I am using ray trace from camera position to the face of camera as below.
I am using only camera's pan and tilt.
In your think, is 'target_pos' correct?
I could found strange working that event occured on incorrect position of entity.
Is it entity's bounding box problem?
I made model entity using 3D MAX and the model is positioned on the origin of model editor.

please give me your expert solution~~



if(camera.pan < 0)
{ camera.pan += 360; }

if(camera.pan > 360)
{ camera.pan -= 360; }

if(camera.tilt < 0)
{ camera.tilt += 360; }

if(camera.tilt > 360)
{ camera.tilt -= 360; }



target_pos.x = camera.x + (cos(camera.pan) * cos(camera.tilt) * 1000);
target_pos.y = camera.y + (sin(camera.pan) * cos(camera.tilt) * 1000);
target_pos.z = camera.z + (sin(camera.tilt) * 1000);
//target_pos.z = camera.z + (cos(camera.pan) * sin(camera.tilt) * 1000);

trace_mode = ignore_me + ignore_maps + ignore_passable + ignore_passents + activate_shoot + use_box;
trace_distance = trace(camera.x, target_pos.x);