Muscle activation options
Muscle states and update function
const { muscleStates, updateMuscleActivations } = useMuscleActivation({
currentAnimation: "attack",
attackAnimation: "jab",
isBlocking: false,
stamina: 85,
});
// In useFrame callback
let frameCounter = 0;
useFrame((_, delta) => {
frameCounter = (frameCounter + 1) % 10;
updateMuscleActivations(delta, frameCounter);
});
// Use muscle states in rendering
<BoneRenderer
rig={rig}
muscleStates={muscleStates}
isExhausted={stamina < 20}
/>
useMuscleActivation hook
Manages muscle activation based on current actions (attack, defend, movement). Updates at 60fps with periodic state syncs to reduce re-renders.