Skip to Content

Apply Option

import { checkOptionActions, useUtilsEditor } from '@amaspace-editor/editor-3d' const changeOption = () => { const { selectOptionWithRules } = checkOptionActions() const editor = useUtilsEditor() return ( <div style={{ height: '200px', overflowY: 'scroll' }}> {editor?.optionsAMA.map(option => { return ( <div onClick={() => { selectOptionWithRules({ option, onComplete: () => { console.log('@complete') } }) }} > {option.name} </div> ) })} </div> ) }

Change Camera

import { useUtilsEditor } from '@amaspace-editor/editor-3d' const editor = useUtilsEditor() const changeCamera = () => { const camera = editor.config.cameras.find(camera => camera.type === AMAMeshType.ConfigurationCamera) if (isCamera(camera)) { editor.changeCameraProps(camera, true) } }

Change Material

import { useUtilsEditor, useUtilsMaterial} from '@amaspace-editor/editor-3d' const utils = useUtilsEditor() const utilsMat = useUtilsMaterial() const changeMaterial = () => { const material = utilsMat.createMaterialFromAsset(asset) const node = utils.getMeshById(id) if (!node) return utils.updateObjectData(node, { material }) }

Enable AR

import { useUtilsEditor } from '@amaspace-editor/editor-3d' const editor = useUtilsEditor() const handleARClick = () => { editor.startARSession() }

Enable VTO

import { useUtilsEditor } from '@amaspace-editor/editor-3d' const VTOButton = ({ children, onClick, ...rest }) => { const editor = useUtilsEditor() const handleEnableVTO = (e) => { onClick?.(e) if (editor.mode !== AMAMode.TRYON) { editor.setMode(AMAMode.TRYON) } else { editor.setMode(AMAMode.VIEWER) } } return ( editor.vto !== 'NONE' && ( <button onClick={handleEnableVTO} {...rest}> {children || <span> VTO </span>} </button> ) ) }
Last updated on