Zweihänder: g1 an rechter Hand anpinnen, Swing auf linken Handballen

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 21:43:05 +02:00
parent b498d0fd5b
commit 6bb195da90
3 changed files with 14 additions and 14 deletions

View File

@@ -13,13 +13,13 @@
"grip": {
"posX": 0.10248406,
"posY": 0.104730606,
"posZ": 0.5130257,
"posZ": 0.4630257,
"rotX": 0.0,
"rotY": 0.0,
"rotZ": 0.0,
"grip2PosX": 0.0024840608,
"grip2PosY": 0.104730606,
"grip2PosZ": 0.5630257,
"grip2PosZ": 0.6630257,
"handOffsetX": 0.0,
"handOffsetY": 0.0,
"handOffsetZ": 0.0

View File

@@ -246,17 +246,18 @@ public class NpcWeaponAttachmentControl extends AbstractControl {
Vector3f leftHandballen = (palmOffsetLocal != null)
? leftHandInChar.subtract(leftBoneRotInChar.mult(palmOffsetLocal.mult(0.5f)))
: leftHandInChar;
leftHandballen.addLocal(0.10f, 0f, 0f);
// Swing: Griffachse auf linken Handballen ausrichten (inkl. X-Korrektur)
Vector3f currentGripDir = weaponRot.mult(g2.subtract(g1).normalizeLocal());
Vector3f targetDir = leftHandInChar.subtract(bonePosInChar).normalizeLocal();
Vector3f targetDir = leftHandballen.subtract(bonePosInChar).normalizeLocal();
float dot = currentGripDir.dot(targetDir);
if (dot > 0f) {
weaponRot = swingFromTo(currentGripDir, targetDir).mult(weaponRot);
}
Vector3f midGrip = g1.add(g2).multLocal(0.5f);
Vector3f midTarget = bonePosInChar.add(leftHandballen).multLocal(0.5f);
Vector3f weaponPos = midTarget.subtract(weaponRot.mult(midGrip));
// g1 exakt an der rechten Hand anpinnen — linke-Hand-Korrekturen beeinflussen rechte nicht
Vector3f weaponPos = bonePosInChar.subtract(weaponRot.mult(g1));
s.setLocalRotation(weaponRot);
s.setLocalTranslation(weaponPos);
}

View File

@@ -297,19 +297,18 @@ public class WeaponAttachmentControl extends AbstractControl {
Vector3f leftHandballen = (palmOffsetLocal != null)
? leftHandInChar.subtract(leftBoneRotInChar.mult(palmOffsetLocal.mult(0.5f)))
: leftHandInChar;
leftHandballen.addLocal(0.10f, 0f, 0f);
Vector3f currentGripDir = weaponRot.mult(g2.subtract(g1).normalizeLocal());
Vector3f targetDir = leftHandInChar.subtract(bonePosInChar).normalizeLocal();
float dot = currentGripDir.dot(targetDir);
// Swing: Griffachse auf linken Handballen ausrichten (inkl. X-Korrektur)
Vector3f currentGripDir = weaponRot.mult(g2.subtract(g1).normalizeLocal());
Vector3f targetDir = leftHandballen.subtract(bonePosInChar).normalizeLocal();
float dot = currentGripDir.dot(targetDir);
if (dot > 0f) {
weaponRot = swingFromTo(currentGripDir, targetDir).mult(weaponRot);
}
// Midpoint-Anker: Mitte von g1–g2 auf Mitte beider Handballen legen
Vector3f midGrip = g1.add(g2).multLocal(0.5f);
Vector3f midTarget = bonePosInChar.add(leftHandballen).multLocal(0.5f);
Vector3f weaponPos = midTarget.subtract(weaponRot.mult(midGrip));
// g1 exakt an der rechten Hand anpinnen — linke-Hand-Korrekturen beeinflussen rechte nicht
Vector3f weaponPos = bonePosInChar.subtract(weaponRot.mult(g1));
weaponSpatial.setLocalRotation(weaponRot);
weaponSpatial.setLocalTranslation(weaponPos);
}