1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-23 16:08:51 -05:00

Fix objects being selected behind a node

This commit is contained in:
Novatux 2014-01-02 14:26:21 +01:00
parent 1ad81c1ce3
commit 91923806a9

View File

@ -239,6 +239,8 @@ PointedThing getPointedThing(Client *client, v3f player_position,
INodeDefManager *nodedef = client->getNodeDefManager(); INodeDefManager *nodedef = client->getNodeDefManager();
ClientMap &map = client->getEnv().getClientMap(); ClientMap &map = client->getEnv().getClientMap();
f32 mindistance = BS * 1001;
// First try to find a pointed at active object // First try to find a pointed at active object
if(look_for_object) if(look_for_object)
{ {
@ -260,16 +262,15 @@ PointedThing getPointedThing(Client *client, v3f player_position,
selection_box->MaxEdge + pos)); selection_box->MaxEdge + pos));
} }
mindistance = (selected_object->getPosition() - camera_position).getLength();
result.type = POINTEDTHING_OBJECT; result.type = POINTEDTHING_OBJECT;
result.object_id = selected_object->getId(); result.object_id = selected_object->getId();
return result;
} }
} }
// That didn't work, try to find a pointed at node // That didn't work, try to find a pointed at node
f32 mindistance = BS * 1001;
v3s16 pos_i = floatToInt(player_position, BS); v3s16 pos_i = floatToInt(player_position, BS);