You can add clickable anchors like this:
<script>
var viewer = WALK.getViewer();
function anchorClicked() {
window.alert('clicked');
}
function sceneReadyToDisplay() {
var anchorConfig = {
position: [1.0, 2.0, 2.5],
type: 'sphere',
radius: 0.07,
text: 'foobar'
};
var anchor = viewer.addAnchor(anchorConfig, anchorClicked);
}
viewer.onSceneReadyToDisplay(sceneReadyToDisplay);
</script>
For a content of the anchorConfig variable, please take a look at the cover.json
file in your Documents\Shapespark\SCENE_NAME\ folder. If you pass the same config as the ones in this file, the anchor added via the API call will look the same as the one added from the editor.