Feat/14 movement overhaul #20

Merged
Dotts merged 86 commits from feat/14-movement-overhaul into main 2026-07-17 10:44:23 -07:00
Showing only changes of commit 1653d404e2 - Show all commits
+27 -37
View File
@@ -110,60 +110,50 @@ func _create_idle_animation(ap: AnimationPlayer) -> void:
anim.length = 2.0 anim.length = 2.0
anim.loop_mode = Animation.LOOP_LINEAR anim.loop_mode = Animation.LOOP_LINEAR
# Get the skeleton path from the scene # Sway the spine (position track)
var skel_path = "MikuRig/Skeleton3D" _create_bone_track(anim, "MikuRig/Skeleton3D:Spine",
# Spine sway
_create_bone_track(anim, skel_path + ":Spine", "rotation",
[ [
{ "time": 0.0, "value": Vector3(0.1, 0, 0) }, { "time": 0.0, "value": Vector3(0, 0.1, 0) },
{ "time": 0.5, "value": Vector3(-0.1, 0, 0) }, { "time": 0.5, "value": Vector3(0, -0.1, 0) },
{ "time": 1.0, "value": Vector3(0.1, 0, 0) }, { "time": 1.0, "value": Vector3(0, 0.1, 0) },
{ "time": 1.5, "value": Vector3(-0.1, 0, 0) }, { "time": 1.5, "value": Vector3(0, -0.1, 0) },
{ "time": 2.0, "value": Vector3(0.1, 0, 0) }, { "time": 2.0, "value": Vector3(0, 0.1, 0) },
]) ])
# Left arm sway # Sway left arm
_create_bone_track(anim, skel_path + ":LeftUpperArm", "rotation", _create_bone_track(anim, "MikuRig/Skeleton3D:LeftUpperArm",
[ [
{ "time": 0.0, "value": Vector3(0, 0, 0.3) }, { "time": 0.0, "value": Vector3(0, 0, 0.2) },
{ "time": 1.0, "value": Vector3(0, 0, 0.5) }, { "time": 1.0, "value": Vector3(0, 0, 0.4) },
{ "time": 2.0, "value": Vector3(0, 0, 0.3) }, { "time": 2.0, "value": Vector3(0, 0, 0.2) },
]) ])
# Right arm sway # Sway right arm
_create_bone_track(anim, skel_path + ":RightUpperArm", "rotation", _create_bone_track(anim, "MikuRig/Skeleton3D:RightUpperArm",
[ [
{ "time": 0.0, "value": Vector3(0, 0, -0.3) }, { "time": 0.0, "value": Vector3(0, 0, -0.2) },
{ "time": 1.0, "value": Vector3(0, 0, -0.5) }, { "time": 1.0, "value": Vector3(0, 0, -0.4) },
{ "time": 2.0, "value": Vector3(0, 0, -0.3) }, { "time": 2.0, "value": Vector3(0, 0, -0.2) },
]) ])
# Neck gentle movement # Hips bounce
_create_bone_track(anim, skel_path + ":Neck", "rotation", _create_bone_track(anim, "MikuRig/Skeleton3D:Hips",
[
{ "time": 0.0, "value": Vector3(0.05, 0, 0) },
{ "time": 1.0, "value": Vector3(-0.05, 0, 0) },
{ "time": 2.0, "value": Vector3(0.05, 0, 0) },
])
# Hips subtle bounce
_create_bone_track(anim, skel_path + ":Hips", "position",
[ [
{ "time": 0.0, "value": Vector3(0, 0, 0) }, { "time": 0.0, "value": Vector3(0, 0, 0) },
{ "time": 0.5, "value": Vector3(0, 0.02, 0) }, { "time": 0.5, "value": Vector3(0, 0.03, 0) },
{ "time": 1.0, "value": Vector3(0, 0, 0) }, { "time": 1.0, "value": Vector3(0, 0, 0) },
{ "time": 1.5, "value": Vector3(0, 0.02, 0) }, { "time": 1.5, "value": Vector3(0, 0.03, 0) },
{ "time": 2.0, "value": Vector3(0, 0, 0) }, { "time": 2.0, "value": Vector3(0, 0, 0) },
]) ])
# Add animation to the player # Add animation to the player via library
ap.add_animation("Idle", anim) var lib = ap.get_animation_library("")
print("SkinnedPlayerModel: created Idle animation with " + str(anim.get_track_count()) + " tracks") lib.add_animation("Idle", anim)
print("SkinnedPlayerModel: created Idle animation with %d tracks" % anim.get_track_count())
func _create_bone_track(anim: Animation, bone_path: String, prop: String, keyframes: Array) -> void: func _create_bone_track(anim: Animation, bone_path: String, keyframes: Array) -> void:
var track_idx = anim.add_track(Animation.TYPE_VALUE) var track_idx = anim.add_track(Animation.TYPE_VALUE)
anim.track_set_path(track_idx, bone_path + ":" + prop) anim.track_set_path(track_idx, bone_path)
anim.track_set_interpolation_type(track_idx, Animation.INTERPOLATION_LINEAR) anim.track_set_interpolation_type(track_idx, Animation.INTERPOLATION_LINEAR)
for kf in keyframes: for kf in keyframes: