Feat/14 movement overhaul #20
@@ -101,7 +101,7 @@ func load_model(path: String) -> void:
|
|||||||
animation_player = _find_animation_player(scene)
|
animation_player = _find_animation_player(scene)
|
||||||
if animation_player:
|
if animation_player:
|
||||||
# Ensure AnimationPlayer processes even if parent has process_mode disabled
|
# Ensure AnimationPlayer processes even if parent has process_mode disabled
|
||||||
animation_player.process_mode = Node.PROCESS_MODE_INHERIT
|
animation_player.process_mode = Node.PROCESS_MODE_ALWAYS
|
||||||
animation_player.active = true
|
animation_player.active = true
|
||||||
print("SkinnedPlayerModel: AP process_mode=%d active=%s" % [animation_player.process_mode, animation_player.active])
|
print("SkinnedPlayerModel: AP process_mode=%d active=%s" % [animation_player.process_mode, animation_player.active])
|
||||||
var anim_list = animation_player.get_animation_list()
|
var anim_list = animation_player.get_animation_list()
|
||||||
@@ -303,13 +303,16 @@ func _add_animation_to_player(ap: AnimationPlayer, anim_name: String, anim: Anim
|
|||||||
print("SkinnedPlayerModel: added '%s' (%d tracks)" % [anim_name, anim.get_track_count()])
|
print("SkinnedPlayerModel: added '%s' (%d tracks)" % [anim_name, anim.get_track_count()])
|
||||||
|
|
||||||
func _update_skin() -> void:
|
func _update_skin() -> void:
|
||||||
## Force skeleton skin update by notifying the Skeleton3D that bones changed.
|
## Force skeleton skin update by re-applying current bone poses.
|
||||||
## GLTF runtime loaded models sometimes need this because the AnimationPlayer's
|
## GLTF runtime loaded models sometimes need this because the AnimationPlayer's
|
||||||
## internal bone pose updates don't always trigger the visual pipeline.
|
## internal bone pose updates don't always trigger the visual pipeline.
|
||||||
# Re-apply current bone poses to ensure dirty flags are set.
|
# Re-apply current bone poses to ensure dirty flags are set.
|
||||||
# This triggers NOTIFICATION_UPDATE_SKELETON on the Skeleton3D.
|
# This triggers NOTIFICATION_UPDATE_SKELETON on the Skeleton3D.
|
||||||
for i in range(skeleton.get_bone_count()):
|
for i in range(skeleton.get_bone_count()):
|
||||||
skeleton.set_bone_pose(i, skeleton.get_bone_pose(i))
|
skeleton.set_bone_pose(i, skeleton.get_bone_pose(i))
|
||||||
|
# Also notify the MeshInstance that its skeleton changed
|
||||||
|
if _mesh_instance:
|
||||||
|
_mesh_instance.skeleton = _mesh_instance.skeleton
|
||||||
|
|
||||||
func _setup_first_person() -> void:
|
func _setup_first_person() -> void:
|
||||||
# In first person, hide the head and upper body so only arms/hands/legs show
|
# In first person, hide the head and upper body so only arms/hands/legs show
|
||||||
|
|||||||
Reference in New Issue
Block a user