Skip to content

fix: the VR hero's feet match the ground - he walks and runs at his body's Gothic animation speeds (x1.4), one owner of the rig's speeds - #583

Open
BoroBongo wants to merge 20 commits into
fix/hero-body-statefrom
fix/hero-speed-matches-steps
Open

BoroBongo wants to merge 20 commits into
fix/hero-body-statefrom
fix/hero-speed-matches-steps

Conversation

@BoroBongo

@BoroBongo BoroBongo commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What

The VR hero's feet match the ground: he walks, runs and sneaks at the speed of his body's own Gothic animations.

  • Speeds from the animations. Walk = S_WALKL's root motion, run (sprint) = S_RUNL's, crouched = S_SNEAKL's, each times the VR body's scale (head height). They are read while the game runs, so Gothic 2, mods and overlays bring their own. Measured in G1: 1.37 / 3.28 / 0.75 m/s at scale 1.

  • 1.4 times as fast (author's choice after a playtest). Walking and running are 1.4x Gothic's loops and the loops play 1.4x as fast, so the feet still match: about 1.8 m/s walking, 4.4 m/s running at normal height. Sneaking keeps its own speed.

  • The speed potion runs with its overlay's own run loop (HUMANS_SPRINT); an overlay without one keeps the old x1.5.

  • One running threshold. Halfway between walk and run speed, for the body's run animation and for BS_RUN, so the stick walks and the sprint runs - for the scripts too.

  • One owner of the rig's speeds. VRHeroMovement is the only writer of the rig's walk/run speed. Water and a transformation hand it an override (VRHeroSpeedService.SetHeroSpeedOverride, an explicit priority list: water first) instead of writing the rig. Wading, swimming and diving move at half the hero's land walk speed without the speed potion (about 0.9 m/s, was a fixed 0.75); leaving the water, loading a game or changing worlds brings the land speeds and sprint straight back.

Technical: VrHeroSpeeds (struct), VRHeroSpeedService (PlayerScope: HeroBodySpeeds, get-only HeroSpeeds with the potion rule, the overrides; EditMode test), VrHeroSpeedOverride / VrHeroSpeedSource, IVrRig.DefaultMoveSpeed / DefaultRunSpeed, VrHeroLocomotion.UpdateSpeeds, VRHeroMovement.UpdateSpeeds, tunables in VRConstants.Movement.

Stacked on #567 (fix/hero-body-state).

ADR: Docs/adr/2026-11-29-hero-speed-from-animations.md (replaces decision 7 of the 2026-11-03 movement ADR).

Why

Playtest: the steps were too short or too long for the speed (fixed 1.5 / 3.5 m/s against the animations' own speeds), sneaking slid, and BS_RUN started at 1 m/s while the body walked until 1.6 m/s.

How to test manually

  • G1 or G2, VR hero body on: walk and sprint. The feet don't slide. The log shows [VRHeroBody] Speeds of HUMANS.MDS/ at scale X: walk ..., run ..., sneak ... (about 1.8 / 4.4 / 0.72 at scale 0.96).
  • Crouch and move: slow sneak with matching feet, sprint does nothing. BS_SNEAK only with the sneak talent.
  • NPC perception: walk up behind a guard (G2: Mika at the east gate) - he still hears the steps. Sprint: BS_RUN (chase give-up, $RUNCOWARD).
  • Speed potion (G1 ItFo_Potion_Haste_01): the log line ends with "(the overlay's own run)", sprint is faster, walking unchanged; back to normal when it ends.
  • Nod or duck physically: the speeds don't change (re-read only beyond a 5 % scale change).
  • Wade into knee-deep water and swim: half the walk speed; leaving the water, the land speeds come back at once (log: the speed source changes).
  • Transform into an animal (spell): monster speeds; back to human: land speeds.

Save/load

Nothing is saved; the speeds are read again from the animations.

Known gaps / follow-ups

  • Sprinting sideways is faster than Gothic's side step animation (the rig has one speed for all directions), so the feet slide there.
  • Reviews: .claude/review/fix-hero-speed-matches-steps/ (architecture: fits with concerns; gothic: no blockers), two review rounds, all findings fixed in this PR (architecture: the single writer of the rig speeds and its own service included); one disagreement (a one-frame potion log lag) in the response file.

🤖 Generated with Claude Code

BoroBongo and others added 14 commits November 29, 2026 03:29
…s go - read from Gothic's animations at the body's scale, the speed potion's run loop included

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… runs at Gothic's walk/run loop speeds times the body's scale, crouched at sneak speed, and BS_RUN starts where the run animation does

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…which play as much faster - the feet still match the ground, sneaking stays

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hanges by more than 5 % - nodding or a physical duck no longer changes them mid-stride

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ring instance - a rebuilt overlay string no longer re-reads and logs the speeds every frame

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…neak speed and BS_SNEAK, and a note that the rig's own speeds must be read before water or a transformation change them

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… live in VRConstants.Movement with the other VR tunables, not in the VrHeroSpeeds model

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rvice.HeroSpeeds) - the body's or the rig's configured speeds (IVrRig.DefaultMoveSpeed/DefaultRunSpeed) with the speed potion, no hand copy of the prefab's 1.5/3.5 and no read-once in Awake

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er and a transformation hand it an override (VRPlayerService.SetHeroSpeedOverride, water first), wading and swimming at half the body's walk speed, no land restores of their own and no blip of the prefab speeds leaving the water

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…speeds, water and a transformation hand it theirs (water first), the rig says its own speeds, wading and swimming at half the hero's walk speed

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ated by Unity on import)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
BoroBongo and others added 6 commits November 29, 2026 16:24
…ed save or a world change while wading no longer leaves the hero walking at half speed without sprint on land (cleared on WorldSceneLoaded always and in OnDestroy, the listener removed)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…at full stick (WalkRunFactor), not about 1 - the playback comment in VrHeroLocomotion said otherwise

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…vice, PlayerScope) - body speeds, speed potion, land speeds and the overrides move out of VRPlayerService, which overrides wins is an explicit priority list (water first) instead of the enum's order, with an EditMode test

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…otion - a potion without a run loop of its own (a mod) no longer speeds up the water by half again

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ir own with the water-first order as a written list, the water at half the walk without the speed potion, land speeds and sprint back after a load or world change in the water

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@BoroBongo

Copy link
Copy Markdown
Contributor Author

AI review (architecture-reviewer + gothic-reviewer), two rounds

Round Commit Architecture Gothic
1 bec6969 fits with concerns (1 major, 4 minor) no blockers (6 risks/nits)
2 d932053 fits with concerns: all 5 earlier findings resolved, 2 new minor all earlier findings resolved, 5 new (1 medium-low)
fixes bac0f40 all round-2 findings fixed

Fixed in this PR (nothing deferred):

  • One writer of the rig's walk/run speed: VRHeroMovement. Water and a transformation hand it an override instead of writing the rig.
  • The speeds, the potion rule and the overrides live in their own VRHeroSpeedService (PlayerScope). The priority is an explicit list, water first, with an EditMode test.
  • Water moves at half the land walk without the potion. The water override is cleared on a world load and when VRSwimDive is destroyed, so a load while wading no longer leaves him slow on land.
  • Nodding or a physical duck no longer re-reads the speeds (5 % scale tolerance). The overlay is compared by name.
  • "The hero sneaks" is one rule (IsCrouchSneaking). The tunables are in VRConstants.Movement.

Not changed, with reasons:

  • The one-frame potion log lag is harmless.
  • A transformed hero counts as running: a monster's own speed is running for the scripts, as before.
  • Without a body, BS_RUN starts at 2.5 m/s, as intended by the ADR (walking is BS_WALK like in Gothic, NPCs still hear walking steps).

Verified locally: compiles, 167/167 EditMode tests, an editor playtest (G1 Mroczne Tajemnice, a Gothic 1 mod): walk 1.84 / run 4.40 / sneak 0.72 m/s at scale 0.96, no exceptions.

Reports and answers: .claude/review/fix-hero-speed-matches-steps/ (bec6969-, d932053-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant