Skip to content

fix(render): Vehicle rendering: passenger seating, alignment, and boat water mask - #85

Merged
zardoy merged 20 commits into
mainfrom
feat/boat-physics-1.17.1
Aug 1, 2026
Merged

zardoy merged 20 commits into
mainfrom
feat/boat-physics-1.17.1

Conversation

@sandexzx

@sandexzx sandexzx commented Jul 12, 2026 •

Copy link
Copy Markdown
Collaborator

Vehicle rendering: passenger seating, alignment, and boat water mask

Context

The renderer had several visible issues with ridden vehicles (boats, horses,
and minecarts):

  1. Boat models did not face their actual movement direction.
  2. The locally controlled vehicle moved on a different interpolation path from
    the player camera, causing relative drift and short forward/backward jumps
    (boats, and later horses on jump and locally ridden minecarts).
  3. Water remained visible through the boat interior because the renderer lacked
    vanilla's depth-only water patch.
  4. Passengers (the local player and remote players) were not anchored to their
    vehicle seats, so riders drifted on their own tween instead of following the
    vehicle across boats, horses, and minecarts.
  5. A rider's network head pitch was not applied, so mounted players did not look
    up/down correctly.

Root causes

Local vehicle jitter

The camera and entity renderer maintained separate interpolation state. Deriving
a vehicle offset from asynchronously updated player and vehicle snapshots
produced a stale horizontal offset during acceleration and input release. The
same class of problem affected locally ridden horses (during jumps) and
locally ridden minecarts.

Passenger seat anchoring

Passengers were positioned by their own entity tween rather than pinned to the
vehicle's seat, so remote riders lagged or drifted relative to the vehicle.

Water inside the hull

Vanilla boats render a dedicated water-mask patch. The renderer had no
equivalent geometry, and an opaque depth mask cannot reliably occlude water
while the hull remains in Three.js's transparent render list.

Model heading

The OBJ boat model's forward axis differs from the physics forward axis by 90
degrees.

Fix

Alignment / interpolation

  • Apply a boat-specific mesh yaw offset without changing entity/world yaw.
  • Add renderer hints for locally controlled vehicles and boat water-patch
    visibility.
  • Keep the local vehicle's X/Z aligned with camera-smoothed movement and
    preserve authoritative vehicle Y instead of copying camera height.
  • Keep ordinary and remote entities on the existing 120 ms tween.
  • Extend the same local-alignment policy to horses (kept aligned during jumps)
    and to locally ridden minecarts (camera-synced); render remote minecart
    passengers smoothly.

Passenger seating

  • Anchor passengers (local and remote) to vehicle seats via a shared
    passenger-anchoring helper, using vanilla-sourced seat offsets for boats,
    minecarts, and horses (including donkey/mule/skeleton-horse variants).
  • Apply a rider's network head pitch to the player head.

Boat water mask

  • Add a vanilla-sized depth-only water patch, positioned with vanilla boat
    bounds.
  • Render boat hull materials as opaque with depth writes enabled.
  • Dispose patch geometry and material with the entity.

Testing

Focused unit and integration coverage was added for:

  • boat and raft entity-name detection, and horse/minecart rideable-name helpers;
  • boat model yaw offset;
  • vanilla water-patch dimensions/bounds, depth-only material settings, and
    hull/patch render ordering;
  • local versus remote interpolation policy, stale passenger snapshots,
    intermediate acceleration/input-release frames, and preserving vehicle Y
    independently from camera Y;
  • boat, horse, and minecart passenger seat positions and anchoring;
  • local minecart passenger rendering;
  • network head-pitch application.

Manual validation (Minecraft 1.17.1) confirmed:

  • the player stays fixed relative to the boat/horse/minecart;
  • acceleration, input release, and horse jumps no longer produce visible jitter;
  • vehicles stay at the correct vertical position;
  • water is not visible inside the boat hull;
  • boat heading matches movement;
  • remote players ride in the correct seat.

Related PRs

Scope

The renderer changes are generic and can merge independently; the complete
controlled-vehicle behavior becomes active when the related web-client
integration is present.

There is no runtime version gate in the renderer. The only version-specific
pieces are hardcoded constants sourced from vanilla 1.17.1 — passenger seat
offsets and the boat water-patch bounds. They render on any version; on versions
whose vanilla seat/attachment values differ, a rider may sit slightly high or
low, which would be corrected by per-version constants in a follow-up.

The one remaining item across all three vehicles is the seated rider pose:
passengers are seated at the correct position but are still rendered standing
(the vanilla sitting pose is not applied yet). This is being finished.

sandexzx added 2 commits July 12, 2026 13:44
Apply the boat-specific yaw offset at mesh level so rendered bows follow the physics heading. Add coverage for boat and raft entity variants.
Keep the controlled boat aligned with camera-smoothed movement while preserving its authoritative height. Add a vanilla-shaped depth mask and opaque hull ordering to hide water inside boats.
@zardoy

zardoy commented Jul 12, 2026

Copy link
Copy Markdown
Owner

@sandexzx does renderer also render mounted vehicle entities correctly as well? Eg would other players see a player riding the boat or other vehicle correctly?

I can add "sit" animation for the correct pose to display

Render remote boat passengers at vanilla seat offsets and keep
their positions synchronized with the interpolated boat movement.

Release the passenger position when it is detached from the boat.
@sandexzx

Copy link
Copy Markdown
Collaborator Author

@zardoy

I tested this from another player's perspective and pushed the fixes.

Remote boat passengers are now propagated from Mineflayer through the web client and anchored to the interpolated boat position in the renderer. This fixes the player drifting away from the boat and handles attach, detach, and vehicle changes.

The remaining issue is the pose: the passenger coordinates use the vanilla seated offset, but the player model is still rendered in the standing/walking pose, which makes it appear partially inside the boat.

As you mentioned, adding a sit animation would resolve this remaining visual issue by rendering the passenger in the correct riding pose.

I have only tested this behavior with boats. The Mineflayer attach/detach changes are vehicle-agnostic and may help with other mounted entities, but the renderer-side positioning currently uses boat-specific seat offsets and logic. Correct rendering for other vehicles is therefore not guaranteed and should be implemented and tested separately.

@zardoy

zardoy commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Awesome, good. yes we can do basic horse/minecart riding as follow-up, feel free to push commits in existing PRs

@zardoy

zardoy commented Jul 13, 2026

Copy link
Copy Markdown
Owner

i will add "sit" animation pose tomorrow, thanks

sandexzx added 5 commits July 13, 2026 09:44
Generalize passenger anchoring for boats and minecarts and align local
and remote riders with the minecart seat.

Smooth server-authoritative camera movement, keep vehicle and camera
interpolation synchronized, and preserve remote head pitch across
animation frames.
Keep the driver's minecart aligned with the interpolated camera instead
of running an independent position tween.

Preserve ordinary interpolation for remote minecarts and keep passenger
anchoring synchronized with the rendered vehicle position.
Anchor local and remote passengers to interpolated horse positions
using variant-specific vanilla seat offsets.

Add a riding player pose and release passenger anchors cleanly after
dismounting.
Resolve the controlled horse height from the camera position to prevent vertical jitter during jump interpolation.
@zardoy

zardoy commented Jul 15, 2026

Copy link
Copy Markdown
Owner

i will add "sit" animation pose tomorrow, thanks

As I understand it's not needed anymore

sandexzx added 11 commits July 17, 2026 22:47
- Match Minecraft 1.17.1 riding limb rotations and preserve them during arm swings.
- Anchor local boat and minecart bodies to rendered seat positions without moving the camera.
- Correct the 1.17.1 minecart passenger offset and preserve the existing local horse path.
- Add finite-coordinate guards, anchor release handling, and production-path tests.

Boat leg clipping and the horse model gap remain visual follow-up work.
- Lower the boat OBJ hull by 0.125 while preserving the water patch height.
- Apply vanilla entity scales for horse, donkey, mule, skeleton horse, and zombie horse models.
- Use vanilla ZYX riding-leg rotations with skinview3d axis conversion.
- Resolve shared transforms for normalized entity types and add regression coverage for boat bounds, horse scales, and riding matrices.
Add time-based paddle animation using the vanilla 1.17.1 phase and
rotation formulas.

Group each paddle under a shared pivot, move the paddle geometry to
the corrected oarlock position, and update both sides from render
hints each frame. Preserve the static OBJ rest pose and water patch
behavior.
Render anchored remote players with the boat body yaw and apply the
network look direction as relative head rotation. Restore the generic
player pose after dismounting.
Mineflayer notch pitch and vanilla gait now map to Three.js rotation.x
with the same sign the horse OBJ expects: look-down stays negative and
gait subtracts from pitch.
Render-only prediction removes head jitter when turning while mounted;
physics and network yaw updates stay on the 20 Hz tick.
@zardoy

zardoy commented Jul 31, 2026

Copy link
Copy Markdown
Owner

@sandexzx lets update physics module in client repo and merge this

@zardoy zardoy changed the title fix(render): stabilize boat rendering and hide interior water fix(render): Vehicle rendering: passenger seating, alignment, and boat water mask Aug 1, 2026
@zardoy
zardoy merged commit 2c65d77 into main Aug 1, 2026
1 check failed
@zardoy
zardoy deleted the feat/boat-physics-1.17.1 branch August 1, 2026 17:00
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.

2 participants