(name, rotation = { x: 0, y: 0, z: 0 }, dampener = 1, lerpAmount = 0.3)
| 71 | |
| 72 | // Animate Rotation Helper function |
| 73 | const 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 |
| 93 | const rigPosition = (name, position = { x: 0, y: 0, z: 0 }, dampener = 1, lerpAmount = 0.3) => { |
no outgoing calls
no test coverage detected