Repository navigation
fix: stop planes snapping heading after landing - #81
Conversation
ConvertedAngle decoded yaw with the wrong denominator, so it was only exact at zero pitch or roll. driveYaw also ignored heading changes from banked turns, so the first ground turn after landing snapped the plane back to its pre-flight heading. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Update yaw calculation and rotation synchronisation src/main/java/net/tfminecraft/vehicleframework/bones/ConvertedAngle.java, src/main/java/net/tfminecraft/vehicleframework/bones/BoneRotator.java, src/test/java/net/tfminecraft/vehicleframework/bones/ConvertedAngleTest.java, src/test/java/net/tfminecraft/vehicleframework/bones/BoneRotatorDriveYawTest.java |
The yaw calculation now uses the X and Y quaternion components in its denominator. After an allowed incremental rotation, BoneRotator synchronises driveYaw from the resulting quaternion. Tests cover eight angle combinations and heading changes after banking and turning. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: ryanbarlow97, xxfran10xx
Merge Risk: 
Minimal · up to f3f7c
-
The heading fix appears ready to merge after normal checks; no actionable issue remains identified.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Fixes the player report that planes suddenly turn about 90° left or right after landing (suggestion
ywrgw-mbr96).Cause
driveYaw. Ground steering (RotateController.turn) sets the heading todriveYaw + turnand snaps instantly.driveYawonly changed on direct yaw input. Planes turn by banking (roll, then pitch), which changed the real heading but notdriveYaw. The first SHIFT_A/D press after landing therefore snapped the plane back to its old heading, and its travel direction with it.ConvertedAngle(Quaternionf). The yaw formula usedy² + z²instead ofx² + y², so it was only exact when pitch or roll was zero. The landingno_lifttarget keeps "current yaw" through this decode, which added up to about 11° of error at normal landing attitudes and more at steep ones.Fix
rotateYXZinverse for yaw.rotateNoAddre-readsdriveYawfrom the bone (syncDriveYaw()).Level vehicles are unaffected because the old and new formulas agree when pitch and roll are zero.
Tests
ConvertedAngleTestround-tripsrotateYXZangles. Six of the eight cases fail on the old formula.BoneRotatorDriveYawTest.bankedTurnHeadingIsWhereGroundTurningStartsbanks and turns 62°, lands, then steers on the ground. Onmain, the plane snaps back to about 1°.🤖 Generated with Claude Code