WiggleRig Reference

WiggleRig

This utility class creates wiggle bones for a whole Skeleton. It is configured by adding values to the userData property of the bones.

  • (1) Bones that define userData.wiggleVelocity are considered wiggle bones.
  • (2) Bones that define userData.wiggleStiffness and userData.wiggleDamping are considered wiggle springs.
  • (3) Other bones are considered static bones.

Tip: Custom properties in Blender can be imported to Three.js as userData properties when using the official gltf exporter/importer.

Example


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();

Constructor

WiggleRig(target: Skeleton);
  • target (required) – reference to the skeleton where the rig will be applied to.

Methods

.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.

Supported by