Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

for retargeting, hide the skeleton helper once we have a target loaded. Better default camera position

Scott Petrovic2ed0a3853184
diff --git a/src/retarget/retarget.ts b/src/retarget/retarget.ts
index 5dc7587..aa3c093 100644
--- a/src/retarget/retarget.ts
+++ b/src/retarget/retarget.ts
@@ -21,7 +21,7 @@ class RetargetModule {
constructor () {
// Set up camera position similar to marketing bootstrap
this.mesh2motion_engine = new Mesh2MotionEngine()
- const camera_position = new Vector3().set(0, 1.7, 5)
+ const camera_position = new Vector3().set(3, 2, 15)
this.mesh2motion_engine.set_camera_position(camera_position)
// Override zoom limits for retargeting to accommodate models of various sizes
@@ -65,9 +65,6 @@ class RetargetModule {
bone_mapping_step.style.display = 'inline'
}
- // show the skeleton helper again since we hid it while on the animation listing step
- this.step_load_source_skeleton.show_skeleton_helper(true)
-
// stop the animation listing step
if (this.animation_listing_step !== null) {
this.animation_listing_step.stop_preview()
@@ -98,7 +95,12 @@ class RetargetModule {
console.error('No retargetable meshes found in the uploaded model.')
return
}
+
AnimationRetargetService.getInstance().set_target_armature(temp_target_armature)
+
+ // hide the skeleton helper since we are on that step
+ this.step_load_source_skeleton.show_skeleton_helper(false)
+
// Set target skeleton data in bone mapping (uploaded mesh)
this.step_bone_mapping.target_armature_updated()
this.start_live_preview()
@@ -123,8 +125,7 @@ class RetargetModule {
// load the animation listing step and start it
this.animation_listing_step = new RetargetAnimationListing(
- this.mesh2motion_engine.get_theme_manager(),
- this.step_bone_mapping
+ this.mesh2motion_engine.get_theme_manager()
)
this.animation_listing_step.begin()
this.mesh2motion_engine.show_animation_player(true)
diff --git a/src/retarget/steps/StepLoadSourceSkeleton.ts b/src/retarget/steps/StepLoadSourceSkeleton.ts
index ca8606c..28e81ea 100644
--- a/src/retarget/steps/StepLoadSourceSkeleton.ts
+++ b/src/retarget/steps/StepLoadSourceSkeleton.ts
@@ -119,9 +119,9 @@ export class StepLoadSourceSkeleton extends EventTarget {
this.loaded_source_armature = gltf.scene.clone() as Group
this.loaded_source_armature.name = 'Source Skeleton Scene (Mesh2Motion)'
- // Offset position to the side so it's visible next to the target skeleton
- this.loaded_source_armature.position.set(2.5, 0, 0)
- this.loaded_source_armature.updateWorldMatrix(true, true)
+ // potentially offset position of skeleton helper. Not in use for now
+ // this.loaded_source_armature.position.set(2.5, 0, 0)
+ // this.loaded_source_armature.updateWorldMatrix(true, true)
console.log('Source skeleton (Mesh2Motion) loaded successfully:', this.loaded_source_armature)