a little snippet, just call it where you put the c-trace (and instead of the mouse_trace vector you can read simply the hit.x vector what you should put after the if statements):

Code:
// get mouse position on terrain surface
void	Camera_Mouse3D1()
{
	VECTOR pos1, pos2;

	vec_set( pos1 , vector(mouse_pos.x,mouse_pos.y,0) );
	vec_for_screen (pos1, camera);
	
	vec_set( pos2 , vector(mouse_pos.x,mouse_pos.y,15000) ); // should be a big value       		
	vec_for_screen (pos2, camera);

	c_trace (pos1.x, pos2.x, IGNORE_ME | IGNORE_CONTENT | IGNORE_SPRITES | IGNORE_PASSABLE | IGNORE_MODELS | IGNORE_MAPS | IGNORE_FLAG2); 
	// if there is a HIT_TARGET event, now "target" and "hit.x" hold the coordinates of the hit point 
	// ignoring tile sprites, models, map-entities and other passable entities including passable terrains (water)      
}



moreover I would use a separate if for the ent_type, because >as I know< in lite-c all the AND-ed comparisons are checked, unlike in C/C++.


Free world editor for 3D Gamestudio: MapBuilder Editor