I'm using the following part of code to tilt the upper part of a entity. The idear is to trace from the camera view, from a closeby point to one far away. The entity is having a bone skeleton and bone 10 should tilt according to the target coming from the trace. The code I'm using;

{
var temp3[3];
var temp4[3];
var bone_angle[3]; // a vector that will hold the pan, tilt and roll angles
temp3.x = (screen_size.x / 2);
temp3.y = (screen_size.y / 2);
temp3.z = 10;
vec_for_screen(temp3,camera);

temp4.x = (screen_size.x / 2);
temp4.y = (screen_size.y / 2);
temp4.z = 8000;
vec_for_screen(temp4,camera);

trace_mode = ignore_me+ignore_passable;
result = trace(temp3,temp4);
bone_angle.tilt = ((target.z+120) * time)/6;
ent_bonerotate(my,"Bone10", bone_angle); // rotate the bone named "Bone10"
}

The problem is that's not working right, when I point the camera upwards the bone tilts correctly, but when I point the camera downwards the bone stops to tilt. Does anyone have a better code to do this or knows how I can fix this? Thanks anyway, Molotov.