Hope this helps you:

Code:

...
trace_mode = ignore_me + ignore_sprites + ignore_models + use_box;
my.z -= trace(my.x, temp);


vec_set(temp,nullvector);
temp.pan = -my.pan;


vec_rotate(normal.x,temp);


my.tilt = -asin(normal.x);
my.roll = -asin(normal.y);