From: Novatux Date: Thu, 2 Jan 2014 13:26:21 +0000 (+0100) Subject: Fix objects being selected behind a node X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=91923806a98fb5cc8e2bf6ed6a864b41337bb3e5;p=zefram%2Fminetest%2Fminetest_engine.git Fix objects being selected behind a node --- diff --git a/src/game.cpp b/src/game.cpp index 33668fb4..c768440d 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -239,6 +239,8 @@ PointedThing getPointedThing(Client *client, v3f player_position, INodeDefManager *nodedef = client->getNodeDefManager(); ClientMap &map = client->getEnv().getClientMap(); + f32 mindistance = BS * 1001; + // First try to find a pointed at active object if(look_for_object) { @@ -260,16 +262,15 @@ PointedThing getPointedThing(Client *client, v3f player_position, selection_box->MaxEdge + pos)); } + mindistance = (selected_object->getPosition() - camera_position).getLength(); result.type = POINTEDTHING_OBJECT; result.object_id = selected_object->getId(); - return result; } } // That didn't work, try to find a pointed at node - f32 mindistance = BS * 1001; v3s16 pos_i = floatToInt(player_position, BS);