EditorConstructor
It is the main component of the library, allows you to visualize the scene
π EditorConstructor Props
| Prop | Type | Description |
|---|---|---|
type | "model" | "material" | "scene" | "texture" | Select the type of asset that will be displayed in the 3D scene. The type must match the asset that you specify in the assetId field. |
assetId | number | string | Asset/Product ID taken from the Amaspace platform |
apiKey | string | API key taken from the Amaspace platform |
presetConfig | object | Editor settings |
π presetConfig Props
| Prop | Default | Type | Description |
|---|---|---|---|
mode | "VIEWER" | "EDITOR" | "TRYON" | Defines the operating mode of the customizer/editor. Untitled | |
applyProductRules | false | boolean | allows you to enable/disable the application of product option rules |
controls | AMAControlsProps | Untitled | |
baseURL | string | The API URL through which all requests will be sent is mainly needed for internal development of Amaspace. You can use βhttps://api.amaspace.co/api/βΒ by default. |
π mode Description
| Mode | Description |
|---|---|
| VIEWER | Read-only mode β the user can preview the scene or product, but cannot make edits. Useful for embedding a 3D viewer. |
| EDITOR | Full editing mode β allows users to interact with the scene, apply customization options, and modify objects/materials. |
| TRYON | Virtual try-on mode β optimized for product placement on a live camera feed (e.g., trying on accessories). |
π AMAControlsPropsProps
| Prop | Default | Type | Description |
|---|---|---|---|
pan | true | boolean | Enables or disables panning (moving the camera across the scene). |
zoomToCursor | false | boolean | Controls whether zoom is centered on the cursor position instead of scene center. |
disable | false | boolean | Disables all camera controls (pan, zoom, rotation). |
Example:
<EditorConstructor
type="model"
assetId={assetId}
apiKey={apiKey}
presetConfig={{
mode: AMAMode.EDITOR,
applyProductRules: false,
customDomain: "https://custom.domain.com"
}}
/>πͺ Hooks
Hooks work only when the editor is mounted in the DOM.
useUtilsEditorβ Core hook for models/scenes UntitleduseUtilsMaterialβ Core hook for materials UntitleduseCustomObjectsβ Create simple shapes UntitleduseCustomLightsβ Create lights UntitleduseCustomCamerasβ Create cameras UntitleduseCheckOptionActionsβ Work with options Untitled
π Workflow
- Add
<EditorConstructor />where needed - Wait for scene load via
useUtilsEditor().loadingProgress - Use hooks to manipulate the scene
Example:
import { useUtilsEditor } from '@amaspace-editor/editor-3d'
const editor = useUtilsEditor()
useEffect(() => {
if (editor.loadingProgress.sceneLoaded) {
console.log("Scene loaded");
}
}, [editor.loadingProgress.sceneLoaded]);Last updated on