Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Setting up the entity that owns the anchor in the Sumerian AR scene.
// Import Sumerian scripts
import * as s from 'module://sumerian-common/api';
import * as si from 'module://sumerian-common/internal';
export default class AnchorPositioningNew extends s.Action {
static get PROPERTIES() {
return {
// Optional property to set the owner of the AR anchor
anchorEntity: {
// Property should be a reference to another entity in the scene
type: s.type.Entity,
// Description for the Amazon Sumerian web UI
description: 'Attach Anchor to this Entity'
}
};
}
start(ctx) {
// Setting up global communication
// -------------------------------------------------------------------
// Create / establish reference to global placeMode setting variable.
// This should be accessible by all components in the scene, so that
// others can for example pause their animations while the user is
// re-positioning the object.
// All variables created with this are stored in this object instance
// and are therefore persisted and accessible from other functions in
// this class.
this.placeMode = ctx.world.value('placeMode');
// Initially, set the place mode to false.
this.placeMode.set(false);
// Get a reference to the WorldPlaced event.
// This is also a global (world) event. This script will emit the
// event once the user finished placing the scene contents.
this.worldPlacedEvent = ctx.world.event('WorldPlaced');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.