mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-08 23:20:12 +00:00
framerate-independent vr aiming
This commit is contained in:
parent
a61f094288
commit
726c2fc871
20
control.cpp
20
control.cpp
@ -801,6 +801,10 @@ EX void mainloopiter() {
|
|||||||
|
|
||||||
#if CAP_VR
|
#if CAP_VR
|
||||||
if(vrhr::active()) {
|
if(vrhr::active()) {
|
||||||
|
static int lastticks = ticks;
|
||||||
|
ld t = (ticks - lastticks) * shiftmul / 400;
|
||||||
|
lastticks = ticks;
|
||||||
|
|
||||||
rug::using_rugview urv;
|
rug::using_rugview urv;
|
||||||
dynamicval<bool> ds(didsomething, didsomething);
|
dynamicval<bool> ds(didsomething, didsomething);
|
||||||
using namespace vrhr;
|
using namespace vrhr;
|
||||||
@ -809,19 +813,19 @@ EX void mainloopiter() {
|
|||||||
transmatrix T = hmd_at * inverse(hmd_ref_at);
|
transmatrix T = hmd_at * inverse(hmd_ref_at);
|
||||||
|
|
||||||
T =
|
T =
|
||||||
cspin(0, 2, -vraim_x * camera_speed / 20) *
|
cspin(0, 2, -vraim_x * camera_speed * t) *
|
||||||
cspin(1, 2, vraim_y * camera_speed / 20) *
|
cspin(1, 2, vraim_y * camera_speed * t) *
|
||||||
cpush(0, -vrgo_x * camera_speed / 20) *
|
cpush(0, -vrgo_x * camera_speed * t) *
|
||||||
cpush(2, -vrgo_y * camera_speed / 20) *
|
cpush(2, -vrgo_y * camera_speed * t) *
|
||||||
T;
|
T;
|
||||||
|
|
||||||
hmd_ref_at = inverse(T) * hmd_at;
|
hmd_ref_at = inverse(T) * hmd_at;
|
||||||
}
|
}
|
||||||
else if(in_perspective_v()) {
|
else if(in_perspective_v()) {
|
||||||
if(vraim_x) full_rotate_camera(0, -vraim_x / 20);
|
if(vraim_x) full_rotate_camera(0, -vraim_x * t);
|
||||||
if(vraim_y) full_rotate_camera(1, vraim_y / 20);
|
if(vraim_y) full_rotate_camera(1, vraim_y * t);
|
||||||
if(vrgo_y) full_forward_camera(-vrgo_y / 20);
|
if(vrgo_y) full_forward_camera(-vrgo_y * t);
|
||||||
if(vrgo_x) full_strafe_camera(-vrgo_x / 20);
|
if(vrgo_x) full_strafe_camera(-vrgo_x * t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user