1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-15 06:17:38 +00:00

vr:: point to the correct side of the sphere

This commit is contained in:
Zeno Rogue
2020-12-30 19:35:15 +01:00
parent 97d5c91240
commit 0f0c4a5d02
2 changed files with 11 additions and 4 deletions

3
vr.cpp
View File

@@ -470,6 +470,8 @@ ld vr_distance(shiftpoint h, int id, ld& dist) {
h.h = hmd_pre_for[2] * h.h;
eModel md = pmodel_3d_version();
apply_other_model(h, hscr, md);
if(in_vr_sphere && get_side(hscr) == (sphereflipped() ? -1 : 1)) return 1e5;
E4; hscr[3] = 1;
hyperpoint hc = inverse(sm * hmd_at * vrdata.pose_matrix[id] * sm) * hmd_mv * hscr;
if(hc[2] > 0.1) return 1e6; /* behind */
@@ -493,6 +495,7 @@ EX void compute_point(int id, shiftpoint& res, cell*& c, ld& dist) {
}
gen_mv();
set_vr_sphere();
c = nullptr;
ld best = 1e9;