Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Hook up bird mesh, skeleton, and base animations to app

Scott Petrovicf5b9d3231ed2
diff --git a/src/index.html b/src/index.html
index bf68d30..c3178b9 100644
--- a/src/index.html
+++ b/src/index.html
@@ -55,8 +55,9 @@
<div style="display: flex; flex-direction: column; gap: 1rem; background-color: #0f2f3d; padding: 1rem;">
<p style="margin: 0">Upload sample model:</p>
<select id="model-selection">
- <option value="models/human-mannequin.glb">Human Mannequin</option>
+ <option value="models/human-mannequin.glb">Human</option>
<option value="models/fox.glb">Fox</option>
+ <option value="models/seagull.glb">Bird</option>
</select>
<button id="load-model-button">Load</button>
</div>
@@ -84,6 +85,7 @@
<select id="skeleton-selection">
<option value="human">Human</option>
<option value="quadraped">4 Leg Creature</option>
+ <option value="bird">Bird</option>
</select>
diff --git a/src/lib/enums/SkeletonType.ts b/src/lib/enums/SkeletonType.ts
index 3be8bf3..c64749e 100644
--- a/src/lib/enums/SkeletonType.ts
+++ b/src/lib/enums/SkeletonType.ts
@@ -2,5 +2,6 @@
// the file names for the skeleton types are associated with the const
export enum SkeletonType {
Quadraped = 'skeletons/skeleton-quadraped.glb',
- Human = 'skeletons/human-skeleton.glb'
+ Human = 'skeletons/human-skeleton.glb',
+ Bird = 'skeletons/skeleton-bird.glb',
}
diff --git a/src/lib/processes/StepAnimationsListing.ts b/src/lib/processes/StepAnimationsListing.ts
index 2d34fff..eb18972 100644
--- a/src/lib/processes/StepAnimationsListing.ts
+++ b/src/lib/processes/StepAnimationsListing.ts
@@ -109,6 +109,9 @@ export class StepAnimationsListing extends EventTarget {
case SkeletonType.Quadraped:
animations_to_load_filepath = 'animations/quad-creature-animations.glb'
break
+ case SkeletonType.Bird:
+ animations_to_load_filepath = 'animations/bird-animations.glb'
+ break
}
this.gltf_animation_loader = new GLTFLoader()
diff --git a/src/lib/processes/StepLoadSkeleton.ts b/src/lib/processes/StepLoadSkeleton.ts
index 50d4037..58b8858 100644
--- a/src/lib/processes/StepLoadSkeleton.ts
+++ b/src/lib/processes/StepLoadSkeleton.ts
@@ -58,6 +58,9 @@ export class StepLoadSkeleton extends EventTarget {
case 'human':
this.skeleton_t = SkeletonType.Human
break
+ case 'bird':
+ this.skeleton_t = SkeletonType.Bird
+ break
}
// load skeleton from GLB file
diff --git a/static/models/seagull.glb b/static/models/seagull.glb
new file mode 100644
index 0000000..182514d
Binary files /dev/null and b/static/models/seagull.glb differ
diff --git a/static/skeletons/skeleton-bird.glb b/static/skeletons/skeleton-bird.glb
new file mode 100644
index 0000000..d0afaf4
Binary files /dev/null and b/static/skeletons/skeleton-bird.glb differ