diff --git a/hyperpoint.cpp b/hyperpoint.cpp index d193d954..e361873b 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -1791,7 +1791,7 @@ EX eShiftMethod shift_method(eShiftMethodApplication sma) { return smGeodesic; } -EX transmatrix shift_object(const transmatrix Position, const transmatrix& ori, const hyperpoint direction, eShiftMethod sm IS(shift_method(smaObject))) { +EX transmatrix shift_object(transmatrix Position, const transmatrix& ori, const hyperpoint direction, eShiftMethod sm IS(shift_method(smaObject))) { switch(sm) { case smGeodesic: return nisot::parallel_transport(Position, direction); @@ -1814,14 +1814,20 @@ EX transmatrix shift_object(const transmatrix Position, const transmatrix& ori, return Position * T; } - transmatrix rot = inverse(map_relative_push(Position * C0)) * Position; + if(geom3::euc_in_sph()) Position = inverse(View) * Position; + + transmatrix rot = inverse(map_relative_push(Position * tile_center())) * Position; + if(moved_center()) rot = rot * lzpush(1); transmatrix urot = unswap_spin(rot); geom3::light_flip(true); transmatrix T = rgpushxto0(direct_exp(urot * direction)); geom3::light_flip(false); swapmatrix(T); - return Position * inverse(rot) * T * rot; + auto res = Position * inverse(rot) * T * rot; + + if(geom3::euc_in_sph()) res = View * res; + return res; } default: throw hr_exception("unknown shift method in shift_object"); } diff --git a/shmup.cpp b/shmup.cpp index c6b67087..e6d31334 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -199,12 +199,15 @@ void full_fix(transmatrix& T) { fixmatrix(T); } else { - hyperpoint h = tC0(T); + hyperpoint h = T * tile_center(); transmatrix rot = iso_inverse(map_relative_push(h)) * T; + if(geom3::euc_in_sph()) rot = rot * lzpush(1); fix_rotation(rot); if(geom3::hyp_in_solnih()) h[0] = 0; - if(geom3::euc_in_nil()) h[1] = 0; + else if(geom3::euc_in_nil()) h[1] = 0; + T = map_relative_push(h) * rot; + if(geom3::euc_in_sph()) T = T * lzpush(-1); fixmatrix(T); } }