Skip to content

fix: keep restored vehicle heading when steering - #60

Merged
XxFran10xX merged 1 commit into
mainfrom
fix/restored-heading-snap
Oct 5, 2026
Merged

XxFran10xX merged 1 commit into
mainfrom
fix/restored-heading-snap

Conversation

@XxFran10xX

Copy link
Copy Markdown
Contributor

Problem

Bug report (Archbishqp, 2026-10-02): starting a ship sometimes flips it 180°. The clip is kleinovac's gunboat on Main (captain seat taken 2026-09-29 19:50:11 UTC at 4331, 3933). At about 35% throttle the boat goes from bow-first to stern-first between two frames 100 ms apart, then sails the opposite way.

Cause

RotateController.turn builds the new heading from BoneRotator.getDriveYaw(), a cached yaw added in 3ebdcb1. Two paths write the bone quaternion without updating that cache:

  • rawSet, used by ActiveVehicle.initializeRotations when a vehicle is loaded from the database (restart, chunk reload)
  • reset, used by TowHandler

After a reload, driveYaw stays at the model's rest yaw. The first A/D press snaps the vehicle back to its spawn heading plus one turn step. Turn rate is 0 while speed is 0 (AccessPanel.getTurnRate), so the snap happens on the first steer once the ship is moving.

Fix

rawSet and reset now set driveYaw from the quaternion they write, the same way the skin-change path (updateModel) already does.

Tests

  • New BoneRotatorDriveYawTest: restore a rotator at 170°, steer once. Without the fix it lands at 1.2°; with the fix it lands at 171.2°. The reset case is covered too.
  • mvn verify: 691 tests pass.

🤖 Generated with Claude Code

Turning steps from the rotator's cached driveYaw. Restoring a saved
rotation (rawSet) and reset() wrote the bone quaternion without updating
that cache, so it stayed at the model's rest yaw. The first A/D press
after a vehicle was loaded from the database snapped it back to its
spawn heading, which players saw as ships flipping 180 degrees when
they started sailing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bf45df71-e046-4c02-be77-c04727227d05
📥 Commits

Reviewing files that changed from the base of the PR and between 1fad64a and a4eecb3.

📒 Files selected for processing (2)
  • src/main/java/net/tfminecraft/vehicleframework/bones/BoneRotator.java
  • src/test/java/net/tfminecraft/vehicleframework/bones/BoneRotatorDriveYawTest.java

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Corrected drive yaw synchronisation after setting or resetting a bone’s rotation, keeping vehicle turning aligned with the displayed heading.
  • Tests
    • Added coverage for left and right turns after restoring a heading or resetting rotation.

Walkthrough

rawSet and reset now synchronise driveYaw with the animator’s rotation. Tests cover turns after restoring and resetting a rotation.

Changes

Bone rotator yaw synchronisation

Layer / File(s) Summary
Synchronise drive yaw after rotation changes
src/main/java/net/tfminecraft/vehicleframework/bones/BoneRotator.java, src/test/java/net/tfminecraft/vehicleframework/bones/BoneRotatorDriveYawTest.java
rawSet and reset update driveYaw from the animator’s rotation. Tests check the yaw after turns following rotation restore and reset.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: ryanbarlow97

Merge Risk: ⚪ Minimal · up to a4eec

No actionable merge-blocking risk is identified; the change is ready for normal merge checks.

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@XxFran10xX
XxFran10xX merged commit 8cde13b into main Oct 5, 2026
2 checks passed
@XxFran10xX
XxFran10xX deleted the fix/restored-heading-snap branch October 5, 2026 15:06
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