Wiggle
This utility class creates wiggle bones for a whole Skeleton. It is configured by adding values to the userData
property of the bones.
userData.wiggleVelocity
are considered wiggle bones.userData.wiggleStiffness
and userData.wiggleDamping
are considered wiggle springs.
import { WiggleRigHelper } from "wiggle/rig";
const bone = skinnedMesh.getObjectByName("LeftBone");
bone.userData.wiggleVelocity = 0.1;
const wiggleRig = new WiggleRig(skinnedMesh.skeleton);
const loop = () => {
requestAnimationFrame(loop);
wiggleRig.update();
};
loop();
WiggleRig(target: Skeleton);
target
(required) – reference to the skeleton where the rig will be applied to..reset()
Resets all the wiggle bones in this rig to their original transforms relative to their parent.
.update(dt: Number)
Animates all the wiggle bones in the rig.
dt
(optional) – time delta since the last update. If not provided, this is calculated internally using performance.now()
.dispose()
Removes all the wiggle bones and reverts the hierarchy to the original state.