mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-01 05:43:22 +01:00
Feature: Animated legendary camouflages
Legendary camo add-ons now play their garage animations in the Tankopedia viewer, and a new menu next to the camo column triggers their battle reactions. **Export (`model.glb` / `skins/[skin].glb`)** - Customization parts export skeletons, skin weights and one clip per `.anim` motion file (`core/blitzkit/skinAnimations`) - Sockets bound to skeleton joints follow their joint - Action lists and scenario graphs are carried in glTF extras - Part batches with no LODs (`lodIndex` -1) are now exported, fixing meshes that were missing entirely (e.g. the Tiger II cat body, the BDT-5A engine rings) - Base tank models are unchanged **Viewer** - A runtime plays the clips and drives state switchers, action lists and the game's scenario graphs (a small interpreter for the node types the camos use) - Camo parts render as primitives so their bones can animate - Garage animations play once rather than looping, so the camo settles **Animation menu** - Floats left of the camo column when the selected camo has triggerable animations - Icon buttons use the game's own white icons, served from `/icons/skin-events/[event].webp` - Idle replays the garage animation - Triggers: Shoot, Kill, Take damage, Damage enemy, Ricochet / No penetration, Start moving, Consumable, Reload. Only events that actually animate get a button - Buttons are disabled while a triggered animation plays; triggering cuts any garage animation short All legendary skin files together grow from 1.32 GB to 1.35 GB (+2.4%), almost all of it in the 102 animated camos.
This commit is contained in:
1 parent
85e03d3b42
commit
ffb5a1f9c8
15 files changed
+1778
-11
No files matched your search
@@ -1,6 +1,13 @@
|
||||
import { alias } from "@blitzkit/core";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import type { Group, Material } from "three";
|
||||
import {
|
||||
Mesh,
|
||||
SkinnedMesh,
|
||||
type AnimationClip,
|
||||
type Group,
|
||||
type Material,
|
||||
type Object3D,
|
||||
} from "three";
|
||||
import { GLTFLoader } from "three-stdlib";
|
||||
import { TRANSITION_ANIMATION_TIME } from "../components/Tankopedia/HeroSection/components/TankSandbox/components/Lighting";
|
||||
import { Tankopedia } from "../stores/tankopedia";
|
||||
@@ -8,6 +15,9 @@ import { Tankopedia } from "../stores/tankopedia";
|
||||
export interface Skin {
|
||||
scene: Group;
|
||||
materials: Map<string, Material>;
|
||||
animations: AnimationClip[];
|
||||
/** customization parts by the tank node they attach to */
|
||||
parts: Map<string, Object3D[]>;
|
||||
}
|
||||
|
||||
const skins = new Map<string, Promise<Skin>>();
|
||||
@@ -19,8 +29,26 @@ async function loadSkin(path: string) {
|
||||
const skin = {
|
||||
scene: gltf.scene,
|
||||
materials: new Map(materials.map((material) => [material.name, material])),
|
||||
animations: gltf.animations,
|
||||
// captured now because rendering moves the parts out of the scene
|
||||
parts: new Map(
|
||||
gltf.scene.children.map((target) => [target.name, [...target.children]]),
|
||||
),
|
||||
};
|
||||
|
||||
for (const parts of skin.parts.values()) {
|
||||
for (const part of parts) {
|
||||
part.traverse((child) => {
|
||||
if (!(child instanceof Mesh)) return;
|
||||
|
||||
child.castShadow = true;
|
||||
child.receiveShadow = true;
|
||||
// bounds are from the bind pose
|
||||
if (child instanceof SkinnedMesh) child.frustumCulled = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
loadedSkins.set(path, skin);
|
||||
|
||||
return skin;
|
||||
|
||||
Reference in new issue
Block a user