Send model transforms to Substance 3D API
The viewer can be used in conjunction with the Substance 3D API to visualize your scene before sending it to the API.
This example illustrates how to get the transforms of every models in your scene and use them with the Substance 3D API.
Example
You can find a more complete example on GitHub: https://git.corp.adobe.com/clockwork/a3d-viewer/tree/develop/examples/src/examples/transformsForSubstance3dApi
How to implement
Using npm :
npm install @a3d-viewer/viewer
Importing :
import { getTransformModelWorldMatrix } from '@a3d-viewer/viewer'
Whether your scene is complex with multiple nested models or just contains a single model, you can use getTransformModelWorldMatrix
to get the transforms of every model in the scene:
import { getTransformModelWorldMatrix } from '@a3d-viewer/viewer'
const viewer = document.querySelector('a3d-viewer')
// In this example, only the first model is used
const modelTransform: Transform = getTransformModelWorldMatrix(viewer.viewerDetails.viewer.loadedModels[0])
// The matrix can be send to the API
console.log(modelTransform.matrix)
Last updated on