Here all you'll need, call this before main and all other functions:
int mouse_triger =0;
VECTOR temp;
ENTITY* eBall;
Call this in while loop in players code:
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
mouse_for_world();
And here is a function, needs to be right before players action:
function mouse_for_world ()
{
if (mouse_left)
{
if(mouse_triger)
{
temp.x = mouse_pos.x;
temp.y = mouse_pos.y;
temp.z = 10000;
vec_for_screen(temp,camera);
if (c_trace(camera.x,temp,IGNORE_ME) > 0)
{
vec_set(eBall.x,target);
}
else
{
vec_set(eBall.x,temp);
}
mouse_triger = 0;
}
}
else
{
mouse_triger = 1;
}
}
And finaly, you need to create model in main function:
eBall = ent_create("earth.mdl",vector(25,25,-200),0);
Good luck
