MCPcopy
hub / github.com/yeemachine/kalidokit / rigRotation

Function rigRotation

docs/script.js:73–90  ·  view source on GitHub ↗
(name, rotation = { x: 0, y: 0, z: 0 }, dampener = 1, lerpAmount = 0.3)

Source from the content-addressed store, hash-verified

71
72// Animate Rotation Helper function
73const rigRotation = (name, rotation = { x: 0, y: 0, z: 0 }, dampener = 1, lerpAmount = 0.3) => {
74 if (!currentVrm) {
75 return;
76 }
77 const Part = currentVrm.humanoid.getBoneNode(THREE.VRMSchema.HumanoidBoneName[name]);
78 if (!Part) {
79 return;
80 }
81
82 let euler = new THREE.Euler(
83 rotation.x * dampener,
84 rotation.y * dampener,
85 rotation.z * dampener,
86 rotation.rotationOrder || "XYZ"
87 );
88 let quaternion = new THREE.Quaternion().setFromEuler(euler);
89 Part.quaternion.slerp(quaternion, lerpAmount); // interpolate
90};
91
92// Animate Position Helper Function
93const rigPosition = (name, position = { x: 0, y: 0, z: 0 }, dampener = 1, lerpAmount = 0.3) => {

Callers 2

rigFaceFunction · 0.70
animateVRMFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected