Exapmle code that integrates echo3D with 8th Wall examples.
Don't have an API key? Make sure to register for FREE at echo3D.
- Create a new 8th Wall project.
- Add echoAR.js to the project files.
- On the JavaScript file that runs your scene, type
import {echoAR} from './echoAR.js';
to import the echo3D class. - Create a new echoAR object using
var echo = new echoAR(YOUR_API_KEY);
. - To download the 3D models from your echo3D console, use the
findObject()
method. Each model will be placed as entries into a JavaScript map. - Use
echo.models.get(ENTRY_ID)
to access these entries in your main JavaScript file, whereENTRY_ID
is the Entry ID listed in the console. - Look through the examples folder to see how echo3D can be implemented on existing 8th Wall demos. Replace any files in the 8th Wall console with their counterparts in the examples folder.
echo.models.get(ENTRY_ID).hologram
is the .glb model whose physical properties can be changed programmatically.echo.models.get(ENTRY_ID).direction
is the direction information that is pulled down from the console intransformations()
. Look at the examples below to see how to rotate models in an animate() function.echo.models.get(ENTRY_ID).url
is the URL of the .glb model.echo.models.get(ENTRY_ID).imageTarget
is the file name of the image target if one exists. Otherwise it is null.
- To initially load the models into the JavaScript map, type
echo.findObject(false, function(data) { // CODE })
, where any code put inside the callback function will run after the models are fully loaded into the map.
- Position:
echo.models.get(ENTRY_ID).hologram.position
- Rotation:
echo.models.get(ENTRY_ID).hologram.rotation
- Scale:
echo.models.get(ENTRY_ID).hologram.scale
- To initially load the models into the JavaScript map, type
echo.findObject(true, function(data) { // CODE })
, where any code put inside the callback function will run after the models are fully loaded into the map.
- Position:
echo.models.get(ENTRY_ID).hologram.object3D.position
- Rotation:
echo.models.get(ENTRY_ID).hologram.object3D.rotation
- Scale:
echo.models.get(ENTRY_ID).hologram.object3D.scale
- Press
Save+Build
to build your 8th Wall project. - Press
Preview
and scan the QR code to run the project on your phone.
Refer to our documentation to learn more about how to use echo3D.
Feel free to reach out at support@echo3D.co or join our support channel on Slack.