aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNovatux <nathanael.courant@laposte.net>2014-01-02 14:26:21 +0100
committerNovatux <nathanael.courant@laposte.net>2014-01-02 14:26:21 +0100
commit91923806a98fb5cc8e2bf6ed6a864b41337bb3e5 (patch)
tree0430cc55390fdfd112265859af23906d92c2b8eb /src
parent1ad81c1ce366ec132d973fba9e02386000abc581 (diff)
downloadminetest-91923806a98fb5cc8e2bf6ed6a864b41337bb3e5.tar.gz
minetest-91923806a98fb5cc8e2bf6ed6a864b41337bb3e5.tar.bz2
minetest-91923806a98fb5cc8e2bf6ed6a864b41337bb3e5.zip
Fix objects being selected behind a node
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 33668fb44..c768440d3 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);