Fix: Address karelpak1's review on animated legendary camouflages

- Sockets bound to a joint now sit right on the joint, as in game. Only the skeleton's own children are bound. This fixes the WZ-114 gun barrels collapsing.
- Clips keep their full duration when it runs past their last key.
- Part states are kept per entity and exported on each part's own switchers, so parts with matching names can't overwrite each other.
- A finished one-shot animation now stops on whatever it switched to, as in game. It only keeps looping if it changes nothing.
- Delayed actions run in delay order.
This commit is contained in:
Mark Greene committed 2026-11-07 15:35:12 +13:00
1 parent 99373872ed
commit 232b3e7770
5 files changed
+83 -72

No files matched your search

+3 -6
View File
@@ -47,7 +47,7 @@ async function loadSkin(path: string) {
for (const clip of gltf.animations) skin.mixer!.clipAction(clip).play();
for (const parts of skin.parts.values()) {
for (const part of parts) preparePart(part, gltf.scene.userData.states);
for (const part of parts) preparePart(part);
}
loadedSkins.set(path, skin);
@@ -56,14 +56,11 @@ async function loadSkin(path: string) {
}
// parts render as they are, so what jsxTree and skinTree would do happens here
function preparePart(part: Object3D, states: Record<string, string | null>) {
function preparePart(part: Object3D) {
part.traverse((object) => {
if (object.userData.state !== undefined) {
const name = nameOf(object);
const state = name in states ? states[name] : object.userData.state;
for (const child of object.children) {
child.visible = nameOf(child) === state;
child.visible = nameOf(child) === object.userData.state;
}
}