Zweihänder: Griffspanne virtuell 22cm, Griff-raten 20cm mit 5cm Pommel-Offset

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 21:37:22 +02:00
parent 911b512208
commit b498d0fd5b
3 changed files with 18 additions and 8 deletions

View File

@@ -37,20 +37,22 @@ public class GripEditorController implements ItemEditorView.GripEditorLauncher {
public void applyGripGuess(float gX, float gY, float gZ) {
if (posXSpin == null) return;
suppressSpinnerEvents = true;
float bladeDirZ = ctx.input().gripEditorBladeDirZ; // -1 = Klinge bei -Z, +1 = Klinge bei +Z
// 5cm Richtung Pommel von der erkannten Parierstange
float posZ = gZ + bladeDirZ * 0.05f;
posXSpin.getValueFactory().setValue((double) gX);
posYSpin.getValueFactory().setValue((double) gY);
posZSpin.getValueFactory().setValue((double) gZ);
posZSpin.getValueFactory().setValue((double) posZ);
// Rotation zurücksetzen: Schaft zeigt zur Klinge, gelber Stab nach oben
rotXSpin.getValueFactory().setValue(0.0);
rotYSpin.getValueFactory().setValue(0.0);
rotZSpin.getValueFactory().setValue(0.0);
// 2. Griff (linke Hand): direkt angrenzend an den 1. Griff, 5cm weiter Richtung Pommel.
// 2. Griff (linke Hand): 20cm Richtung Pommel vom 1. Griff (Zweihänder-Grifflänge).
// Grip2-Spinner = Modell-Koordinaten direkt (kein HAND_GRIP_OFFSET), deshalb JSON-Pos von Grip1 verwenden.
float bladeDirZ = ctx.input().gripEditorBladeDirZ; // -1 = Klinge bei -Z, +1 = Klinge bei +Z
float grip1JsonZ = gZ + ItemGrip.HAND_GRIP_OFFSET_Z;
float grip1JsonZ = posZ + ItemGrip.HAND_GRIP_OFFSET_Z;
grip2XSpin.getValueFactory().setValue((double) gX);
grip2YSpin.getValueFactory().setValue((double) gY);
grip2ZSpin.getValueFactory().setValue((double)(grip1JsonZ - bladeDirZ * 0.05f));
grip2ZSpin.getValueFactory().setValue((double)(grip1JsonZ - bladeDirZ * 0.20f));
suppressSpinnerEvents = false;
onSpinnerChanged();
}
@@ -220,7 +222,7 @@ public class GripEditorController implements ItemEditorView.GripEditorLauncher {
row("Z:", rotZSpin),
new Separator(),
styledTitle("2. Griff – Linke Hand (m)"),
styledHint("Zweiter Griffpunkt (blaues Gizmo) für Zweihänder.\nDirekt angrenzend an den 1. Griff, Richtung Knauf."),
styledHint("Zweiter Griffpunkt (blaues Gizmo) für Zweihänder.\n~20cm Richtung Knauf vom 1. Griff."),
row("X:", grip2XSpin),
row("Y:", grip2YSpin),
row("Z:", grip2ZSpin),