Skip to content

Commit 1a790e9

Browse files
committed
Client: Draw block face selection slightly over it
1 parent db506a2 commit 1a790e9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Game/States/GameState.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,8 @@ namespace tsom
10571057
}
10581058

10591059
auto cornerPos = hitChunk.ComputeBlockCorners(hitCoordinates->blockIndices);
1060+
for (Nz::Vector3f& pos : cornerPos)
1061+
pos = chunkNode.ToGlobalPosition(pos) + raycastHit->hitNormal * 0.02f;
10601062

10611063
constexpr Nz::EnumArray<Direction, std::array<Nz::BoxCorner, 4>> directionToCorners = {
10621064
// Back
@@ -1075,10 +1077,10 @@ namespace tsom
10751077

10761078
auto& corners = directionToCorners[hitCoordinates->direction];
10771079

1078-
debugDrawer->DrawLine(chunkNode.ToGlobalPosition(cornerPos[corners[0]]), chunkNode.ToGlobalPosition(cornerPos[corners[1]]), Nz::Color::Green());
1079-
debugDrawer->DrawLine(chunkNode.ToGlobalPosition(cornerPos[corners[1]]), chunkNode.ToGlobalPosition(cornerPos[corners[2]]), Nz::Color::Green());
1080-
debugDrawer->DrawLine(chunkNode.ToGlobalPosition(cornerPos[corners[2]]), chunkNode.ToGlobalPosition(cornerPos[corners[3]]), Nz::Color::Green());
1081-
debugDrawer->DrawLine(chunkNode.ToGlobalPosition(cornerPos[corners[3]]), chunkNode.ToGlobalPosition(cornerPos[corners[0]]), Nz::Color::Green());
1080+
debugDrawer->DrawLine(cornerPos[corners[0]], cornerPos[corners[1]], Nz::Color::Green());
1081+
debugDrawer->DrawLine(cornerPos[corners[1]], cornerPos[corners[2]], Nz::Color::Green());
1082+
debugDrawer->DrawLine(cornerPos[corners[2]], cornerPos[corners[3]], Nz::Color::Green());
1083+
debugDrawer->DrawLine(cornerPos[corners[3]], cornerPos[corners[0]], Nz::Color::Green());
10821084
}
10831085
}
10841086
else if (auto* interactible = raycastHit->hitEntity.try_get<ClientInteractibleComponent>(); interactible && interactible->isEnabled)

0 commit comments

Comments
 (0)