Feat/14 movement overhaul #20
@@ -500,14 +500,21 @@ func _process(delta: float) -> void:
|
||||
if target_anim != _current_anim_name:
|
||||
_current_anim_name = target_anim
|
||||
_anim_time = 0.0
|
||||
# Play on AP only for non-procedural anims (Death, Crouch)
|
||||
# Procedural anims are applied directly to bones — AP must NOT
|
||||
# play GLB anims or it will overwrite our manual bone poses
|
||||
if animation_player and animation_player.has_animation(target_anim):
|
||||
if not _procedural_anims.has(target_anim):
|
||||
animation_player.play(target_anim)
|
||||
else:
|
||||
# For procedural anims: stop AP completely so it doesn't overwrite our poses
|
||||
# For GLB anims (Death, Crouch): play on AP
|
||||
if _procedural_anims.has(target_anim):
|
||||
if animation_player:
|
||||
animation_player.stop()
|
||||
animation_player.active = false
|
||||
# Reset all bones to rest pose before applying procedural animation
|
||||
if skeleton:
|
||||
for i in range(skeleton.get_bone_count()):
|
||||
skeleton.set_bone_pose_position(i, Vector3.ZERO)
|
||||
skeleton.set_bone_pose_rotation(i, Quaternion.IDENTITY)
|
||||
skeleton.set_bone_pose_scale(i, Vector3.ONE)
|
||||
elif animation_player and animation_player.has_animation(target_anim):
|
||||
animation_player.active = true
|
||||
animation_player.play(target_anim)
|
||||
|
||||
# Advance animation time
|
||||
if _procedural_anims.has(_current_anim_name):
|
||||
@@ -526,8 +533,9 @@ func _process(delta: float) -> void:
|
||||
if _anim_debug_timer > 1.0:
|
||||
_anim_debug_timer = 0.0
|
||||
print("SkinnedPlayerModel: procedural '%s' t=%.2f" % [_current_anim_name, _anim_time])
|
||||
elif animation_player:
|
||||
# For non-procedural anims (Death, Crouch from GLB), just update skin
|
||||
else:
|
||||
# For non-procedural anims (Death, Crouch from GLB), use AP
|
||||
if animation_player:
|
||||
call_deferred("_update_skin")
|
||||
# Debug output
|
||||
_anim_debug_timer += delta
|
||||
|
||||
Reference in New Issue
Block a user