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

Function rigRotation

sample/3d/script.js:77–96  ·  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

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

Callers 2

rigFaceFunction · 0.70
animateVRMFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected