Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Add Mesh2Motion engine to setup 3d scene

Scott Petrovic8761045a25cf
diff --git a/src/create.html b/src/create.html
index b9b775e..73857a6 100644
--- a/src/create.html
+++ b/src/create.html
@@ -427,7 +427,7 @@
</div>
- <!-- 3d view control hit box. It is just a container to help with 3d view controls. -->
+ <!-- 3d view controls shown on bottom right. This helps with click events -->
<div id="view-control-hitbox"></div>
<!-- build version information-->
diff --git a/src/retarget/index.html b/src/retarget/index.html
index 244d7b5..c55c796 100644
--- a/src/retarget/index.html
+++ b/src/retarget/index.html
@@ -37,14 +37,15 @@
</button>
</div>
</nav>
-
- <h1>Retargeting Example</h1>
<div style="padding: 2rem;">
<input type="file" id="upload-file" accept=".glb,.fbx,.zip" style="display: none;" />
<label for="upload-file" class="button">Choose 3D Model File</label>
</div>
+ <!-- 3d view controls shown on bottom right. This helps with click events -->
+ <div id="view-control-hitbox"></div>
+
<script type="module" src="./retarget.ts"></script>
</body>
</html>
\ No newline at end of file
diff --git a/src/retarget/retarget.ts b/src/retarget/retarget.ts
index 260d155..1ea77f2 100644
--- a/src/retarget/retarget.ts
+++ b/src/retarget/retarget.ts
@@ -1,6 +1,17 @@
+import { Mesh2MotionEngine } from '../Mesh2MotionEngine.ts'
+import { Vector3 } from 'three'
+
class RetargetModule {
+ private mesh2motion_engine: Mesh2MotionEngine
private fileInput: HTMLInputElement | null = null
+ constructor () {
+ // Set up camera position similar to marketing bootstrap
+ this.mesh2motion_engine = new Mesh2MotionEngine()
+ const camera_position = new Vector3().set(0, 1.7, 5)
+ this.mesh2motion_engine.set_camera_position(camera_position)
+ }
+
public add_event_listeners (): void {
// Get DOM elements
this.fileInput = document.getElementById('upload-file') as HTMLInputElement