Skip to content

Commit

Permalink
Fix objects being selected behind a node
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekdohibs committed Jan 2, 2014
1 parent 1ad81c1 commit 9192380
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);

Expand Down

0 comments on commit 9192380

Please sign in to comment.