Skip to content

Commit 523a044

Browse files
committed
Keep a VR seat's facing while its vehicle stands on its nose
A VR seat follows its vehicle's turns through the yaw of the vehicle's nose. A nose pointing almost straight up or down keeps only a sliver of horizontal direction to take that yaw from. mcc_2's launch arm stands the drop pod 0.07 degrees short of the vertical. There, a hundredth of a degree of sideways wobble would swing the yaw 8 degrees, and crossing the vertical would flip it half a turn, turning the whole world in one frame. A nose within six degrees of vertical now carries nothing, and the seat keeps its facing until the nose has a heading again. Every probed ride carries exactly as before. tram1b's tram pitches 9 degrees at most, storage1's crash pod 35, and mcc_2's pod keeps its heading until it stands in the tube. The twist about the world's up of each frame's rotation would also have avoided the flip. It was tried and dropped: it parted from the nose's heading by up to 8.8 degrees over storage1's crash, where the pod rolls to -48 degrees while pitched. Probed both drop pod rides in VR. storage1's pod falls for 30 s, then crashes through the tower; its largest turn in one tic is 2 degrees. mcc_2's arm swings its pod from nose down to nose up in the launch tube, after the level's opening bed ride. Every ride stays in stereo with a level view. The VR smoke, the source contract and the affected CI tests pass.
1 parent f8c6c18 commit 523a044

5 files changed

Lines changed: 33 additions & 5 deletions

File tree

‎docs/dev/plans/2026-10-02-openxr-vr.md‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,21 @@ not open an XR frame and draw to the window as before.
416416
track at a constant offset, and the gun tracked it. Medlabs' table ride
417417
(the Stroggification) carries the view down its track the same way: the
418418
eye looks from the head along the strapped body, in stereo, through
419-
every stop and turn of 40 s of the ride.
419+
every stop and turn of 40 s of the ride. So do mcc_2's opening bed and
420+
both drop pods. storage1's pod falls for 30 s and then crashes through
421+
the tower, pitching between -24 and +35 degrees, its largest turn in a
422+
tic 2 degrees; mcc_2's launch arm swings its pod from nose down through
423+
level to nose up in the tube, and the level view lets the pod turn about
424+
the head instead of laying the player on their back. The arm stands the
425+
pod 0.07 degrees short of the vertical, where the nose keeps a horizontal
426+
sliver a thousandth long: a hundredth of a degree of sideways wobble
427+
would swing its yaw 8 degrees, and crossing the vertical would flip it
428+
half a turn. So a nose within six degrees of vertical carries nothing,
429+
and the seat keeps its facing until the nose has a heading again. The
430+
twist of each frame's rotation about the world's up has no such point,
431+
but it is not the nose's heading: it parted from it by up to 8.8 degrees
432+
over storage1's crash, where the pod rolls to -48 degrees while
433+
pitched, and the nose is what the seat keeps in front of the player.
420434
- *The engine turns the stick into the weapon hand's aim*, which a vehicle
421435
never sees, so a hand pointed aside made the tank strafe. The game turns
422436
the stick back to the head, which the vehicle faces.

‎docs/dev/release-completion.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
vignette during stick movement and smooth turning, scope zoom that
9696
magnifies each eye, single player vehicles and turrets in stereo (the eye
9797
on the turret's axis, the turret following the head, the seat keeping its
98-
own facing through the vehicle bind), a weapon wheel that no longer turns
98+
own facing through the vehicle bind; the tram gun, the medical table, the
99+
bed and both drop pod rides probed start to finish), a weapon wheel that no longer turns
99100
the world, and a Virtual
100101
Reality section in
101102
Settings > Game Options (twelve rows, twelve languages). Building that section

‎docs/dev/releases/v0.13.2.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
without lowering your view twice. In single player the hovertank, the
8383
walker and the mounted guns surround you in stereo too
8484
(`vr_vehicleStereo`): you sit where the turret turns, it turns where you
85-
look, and the trigger fires.
85+
look, and the trigger fires. Scripted rides, from the tram's rear gun to
86+
the drop pods, carry you in stereo as well, with the horizon kept level.
8687
In menus the weapon-hand controller points and clicks. Temporal anti-aliasing and dynamic resolution switch off while VR
8788
presents. `vr_status`, `vr_recenter` and `vr_restart` help with setup, and the
8889
desktop window mirrors the left eye by default.

‎docs/user/vr.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ trigger to fire. The laser dot shows where the shots will land, and each shot
200200
kicks in your weapon hand. The left stick drives the way the vehicle faces.
201201
A vehicle that turns under you, such as a walker turning on the spot, turns
202202
your view with it, and the comfort vignette darkens the edges of your view
203-
while a vehicle moves you.
203+
while a vehicle moves you. Scripted rides seat you the same way, from the
204+
tram's rear gun to the drop pods. Your view stays level whatever the ride
205+
does, so a pod swung nose-up into its launch tube turns around you instead
206+
of tipping you onto your back.
204207

205208
| Setting | Default | What it does |
206209
| --- | --- | --- |

‎src/game/Player.cpp‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13527,7 +13527,16 @@ void idPlayer::UpdateVRVehicleFrame( void ) {
1352713527
vrVehicleYawValid = false;
1352813528
return;
1352913529
}
13530-
const float yaw = vehicle->GetAxis().ToAngles().yaw;
13530+
// a nose within six degrees of straight up or down has no heading to
13531+
// follow: its yaw rests on a sliver of the axis and flips half a turn as
13532+
// it crosses the vertical (mcc_2's launch arm stands the drop pod 0.07
13533+
// degrees short of it), so the seat keeps its facing until one returns
13534+
const idVec3 &nose = vehicle->GetAxis()[ 0 ];
13535+
if ( nose.ToVec2().LengthSqr() < 0.01f ) {
13536+
vrVehicleYawValid = false;
13537+
return;
13538+
}
13539+
const float yaw = nose.ToYaw();
1353113540
if ( vrVehicleYawValid ) {
1353213541
vrVehicleDeltaYaw = idMath::AngleNormalize180( vrVehicleDeltaYaw + idMath::AngleDelta( yaw, vrVehicleYaw ) );
1353313542
}

0 commit comments

Comments
 (0)