Using FBX file via Theme App Extension

Solved

Using FBX file via Theme App Extension

fwdevon
Shopify Partner
2 1 0

In a theme extension app I have a single script that utilizes the node modules three.js and mediapipe/tasks-vision. The script interacts with the user's webcam to analyze where their body is within the camera frame. This is fine and works in an embedded window of the theme in the online store preview. The goal of this app is to display the clothing item onto the customer's body. This works outside of Shopify using FBXLoader and an FBX file. I need a way of storing the FBX file in either the Shopify store or the extension app that I'm building. However the only resources I can find are saying you have to use a GLB file. Shopify isn't using or interacting with the fbx file only the javascript from within the extension app so is there any way I can store the fbx file and reference it from the theme extension app? Here is how I'm currently loading the fbx file from the javascript in my assets folder:

function loadModel(){
  const loader = new FBXLoader();
  loader.load('/Hoodie3.fbx', (object) => {
    model3D = object;
    const boundingBox = new THREE.Box3().setFromObject(model3D);

    const size = new THREE.Vector3();
    boundingBox.getSize(size);

    modelWidth = size.x;
    modelHeight = size.y;
    modelDepth = size.z;

    fixedRatio = modelWidth/190;
    shirtRatioHeightWidth = modelHeight/modelWidth;
    getCustomProperty(model3D);

    scene.add(model3D);
    // Render loop for 3D model
    renderModel();
  });
}
Accepted Solution (1)

fwdevon
Shopify Partner
2 1 0

This is an accepted solution.

Solution:

Since a javascript file from my app is the only thing using the fbx file I just dropped the file into the "files" section in the content section of admin shopify page. Then I was able to access the fbx file with a CDN link shopify generated for the file.  

View solution in original post

Reply 1 (1)

fwdevon
Shopify Partner
2 1 0

This is an accepted solution.

Solution:

Since a javascript file from my app is the only thing using the fbx file I just dropped the file into the "files" section in the content section of admin shopify page. Then I was able to access the fbx file with a CDN link shopify generated for the file.