From 295b8f7e8ce9b448c7d916e4fec839e110b1307c Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Thu, 9 May 2024 01:51:05 -0400 Subject: [PATCH] Raw unsalted bone manipulation --- source/player_model/init.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/player_model/init.ts b/source/player_model/init.ts index bc6ba70d..e1798ab7 100644 --- a/source/player_model/init.ts +++ b/source/player_model/init.ts @@ -10,6 +10,7 @@ namespace playerModel { const Keys = _Keys; type Keys = _Keys; const isKeyDown = controls.isKeyDown; + const setPlayerBoneRotation = animationStation.setPlayerBoneRotation; /* character.b3d bone documentation, tree view. @@ -115,8 +116,11 @@ namespace playerModel { }); }); + // todo: Make this use less objects. + // speed based animation utility.onStep((_: number) => { + for (const player of minetest.get_connected_players()) { let vel = player.get_velocity(); let speed = vector.length(vel); @@ -150,6 +154,12 @@ namespace playerModel { setPlayerBoneAnimationSpeed(player, "Arm_Right", speed); } } + + // Head bone. + const lookDir = player.get_look_vertical(); + setPlayerBoneRotation(player, "Head", create3d(-lookDir, 0, 0)); + + } }); } \ No newline at end of file