Kampfsystem - hier: Anker beim Kurzschwert, sowohl für Helden als auch NPC
This commit is contained in:
@@ -217,7 +217,10 @@ public class NpcWeaponAttachmentControl extends AbstractControl {
|
||||
Quaternion animDelta = (handBindRotInChar != null)
|
||||
? boneRotInChar.mult(handBindRotInChar.inverse())
|
||||
: boneRotInChar;
|
||||
boolean bladeAtMinusZ = grip != null && grip.getGrip2PosZ() != 0f && grip.getGrip2PosZ() > grip.getPosZ();
|
||||
boolean bladeAtMinusZ = grip != null && (
|
||||
(grip.getGrip2PosX() != 0f || grip.getGrip2PosY() != 0f || grip.getGrip2PosZ() != 0f)
|
||||
? grip.getGrip2PosZ() > grip.getPosZ()
|
||||
: grip.getPosZ() > 0f);
|
||||
Quaternion bladeFlip = bladeAtMinusZ
|
||||
? new Quaternion().fromAngles(com.jme3.math.FastMath.PI, 0f, 0f)
|
||||
: new Quaternion();
|
||||
@@ -227,6 +230,9 @@ public class NpcWeaponAttachmentControl extends AbstractControl {
|
||||
: new Vector3f(cfg.getHandOffX(), cfg.getHandOffY(), cfg.getHandOffZ());
|
||||
Vector3f weaponPos = bonePosInChar.subtract(weaponRot.mult(gripPos));
|
||||
weaponPos = weaponPos.add(weaponRot.mult(handOff));
|
||||
if (grip != null && (grip.getHandOffsetX() != 0f || grip.getHandOffsetY() != 0f || grip.getHandOffsetZ() != 0f)) {
|
||||
weaponPos = weaponPos.add(grip.getHandOffsetX(), grip.getHandOffsetY(), grip.getHandOffsetZ());
|
||||
}
|
||||
s.setLocalRotation(weaponRot);
|
||||
s.setLocalTranslation(weaponPos);
|
||||
}
|
||||
@@ -288,17 +294,20 @@ public class NpcWeaponAttachmentControl extends AbstractControl {
|
||||
DEG_TO_RAD * grip.getRotY(),
|
||||
DEG_TO_RAD * grip.getRotZ())
|
||||
: new Quaternion();
|
||||
boolean bladeAtMinusZ2 = grip != null && grip.getGrip2PosZ() != 0f && grip.getGrip2PosZ() > grip.getPosZ();
|
||||
boolean bladeAtMinusZ2 = grip != null && (
|
||||
(grip.getGrip2PosX() != 0f || grip.getGrip2PosY() != 0f || grip.getGrip2PosZ() != 0f)
|
||||
? grip.getGrip2PosZ() > grip.getPosZ()
|
||||
: grip.getPosZ() > 0f);
|
||||
Quaternion bladeFlip2 = bladeAtMinusZ2
|
||||
? new Quaternion().fromAngles(com.jme3.math.FastMath.PI, 0f, 0f)
|
||||
: new Quaternion();
|
||||
Quaternion weaponRot = boneRotInChar.mult(BACK_ROT_NORM).mult(bladeFlip2).mult(gripRot.inverse());
|
||||
Vector3f target = boneInChar.add(boneRotInChar.mult(
|
||||
twoHanded ? TWO_HAND_BACK_GRIP_OFFSET : BACK_GRIP_OFFSET));
|
||||
// X=0: Waffenmitte (nicht handspezifischer Griffpunkt) auf Wirbelsäule zentrieren
|
||||
Vector3f gripPos = grip != null
|
||||
? new Vector3f(grip.getPosX(), grip.getPosY(), grip.getPosZ()) : Vector3f.ZERO;
|
||||
? new Vector3f(0f, grip.getPosY(), grip.getPosZ()) : Vector3f.ZERO;
|
||||
Vector3f backPos = target.subtract(weaponRot.mult(gripPos));
|
||||
if (bladeAtMinusZ2) backPos = backPos.add(0.1f, 0f, 0f);
|
||||
s.setLocalRotation(weaponRot);
|
||||
s.setLocalTranslation(backPos);
|
||||
}
|
||||
|
||||
@@ -1429,6 +1429,12 @@ public class PlayerInputControl implements CombatStyleBase.AnimReceiver {
|
||||
private void handleCombatAlt(boolean isPressed) {
|
||||
if (!weaponDrawn) return;
|
||||
if (isMeleeType(drawnWeaponType)) {
|
||||
// Schwert blockt per Schild – ohne Schild ist Blocken nicht möglich.
|
||||
// Zweihänder/Axt blocken mit der Waffe selbst, brauchen keinen Schild.
|
||||
if (drawnWeaponType == ItemSubCategory.SWORD && !hasShieldEquipped()) {
|
||||
rightMouseHeld = false;
|
||||
return;
|
||||
}
|
||||
if (isPressed) {
|
||||
rightMouseHeld = true;
|
||||
// Sofort blocken nur wenn keine andere Animation läuft
|
||||
|
||||
Reference in New Issue
Block a user