fix(characters): rig-independent weapon mount, measured facing, revert Miku
WEAPON MOUNT, all models. set_weapon() seated the gun with a fixed rotation_degrees = (0, 90, -90). A bone attachment is expressed in the BONE's axes and no two rigs agree on those, so one constant mounted the weapon differently on every character. It never needed to be right: the pose layer aims the gun by rotating the wrist until the weapon's forward lies on the aim line, so the identity means "forward is the hand bone's -Z", which is true on any rig, and the wrist absorbs the roll. The grip now sits at the bone origin, so the gun is in the hand rather than at an offset from a differently-oriented bone. Verified by render on kiyoko: rifle shouldered, both hands on it. FACING. flatten_and_scale() now measures toes-versus-ankles and snaps the character to face Blender -Y, the convention the runtime's blanket flip is built around. Kiyoko was 180 degrees off. Snapped to the nearest quarter turn so splayed feet in a rest pose are not read as a turned character. MIKU. Re-imported without --grow-cloth. Her grown hair chains were the cause of the stretching: cloth_bones.py clears a vertex's body weights and re-assigns it to the fitted polyline, so a poor fit does not degrade to "stiff", it degrades to "torn". She now has no hair simulation — stiff but correct — until that tool blends against the weights it replaces instead of destroying them. ARIA'S SKIRT IS NOT SIMULATED. Worth recording plainly, because it looks better than Taila's and the obvious conclusion is the wrong one: aria has ZERO cloth chains. Her skirt never clips because it is rigidly skinned and follows the legs it is weighted to. There is nothing to port to Taila except switching her simulation off. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
27c4117c25
commit
c8b0337aa7
@@ -908,17 +908,27 @@ func set_weapon(script_path: String) -> void:
|
||||
# (weapon swap while toggled), else the new weapon comes up invisible.
|
||||
if (shadows_only or first_person_mode) and not _owner_visible:
|
||||
_set_shadows_recursive(w)
|
||||
# Undo the first-person viewmodel placement from the weapon's _ready:
|
||||
# lie along the hand's grip, scaled down to character proportions.
|
||||
w.position = Vector3(-0.02, 0.07, 0.0)
|
||||
w.rotation_degrees = Vector3(0, 90, -90)
|
||||
w.scale = Vector3(1.0, 1.0, 1.0)
|
||||
# Tell the pose layer the gun's axes in hand-bone space so it can
|
||||
# aim the wrist to point the muzzle exactly where the player looks.
|
||||
# Seat the weapon in the hand with NO hand-relative rotation.
|
||||
#
|
||||
# There used to be a fixed `rotation_degrees = (0, 90, -90)` here, which
|
||||
# is the offset that happens to be right for the library's own DEF-hand.R
|
||||
# and is wrong for every rig whose hand bone has a different roll. A bone
|
||||
# attachment is expressed in the BONE's axes, and no two rigs agree on
|
||||
# those, so a constant here mounts the gun differently on every character
|
||||
# — which is what "the hand mount points are totally wrong on all models"
|
||||
# was.
|
||||
#
|
||||
# It does not need to be right, because the pose layer aims the gun by
|
||||
# rotating the WRIST until the weapon's forward axis lies on the aim line
|
||||
# (see _apply_rifle_hold). Handing it the identity means "the gun's
|
||||
# forward is the hand bone's -Z", which is true by construction on any
|
||||
# rig, and the wrist then absorbs whatever that bone's roll happens to be.
|
||||
# The grip is placed at the bone's origin below, so the gun sits IN the
|
||||
# hand rather than at a fixed offset from a differently-oriented bone.
|
||||
w.transform = Transform3D.IDENTITY
|
||||
if _pose_mod:
|
||||
var b: Basis = w.transform.basis.orthonormalized()
|
||||
_pose_mod.gun_fwd_hand = b * Vector3(0, 0, -1)
|
||||
_pose_mod.gun_up_hand = b * Vector3(0, 1, 0)
|
||||
_pose_mod.gun_fwd_hand = Vector3(0, 0, -1)
|
||||
_pose_mod.gun_up_hand = Vector3(0, 1, 0)
|
||||
_measure_weapon(w)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user