Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created February 22, 2020 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/3ede773a51d5aec83ec5404a6cd88078 to your computer and use it in GitHub Desktop.
Save flushpot1125/3ede773a51d5aec83ec5404a6cd88078 to your computer and use it in GitHub Desktop.
define({
// The input ports of the Javascript node, name of input and type
inputs:{
// ExampleInput:'number',
// Available types are 'number', 'string', 'boolean', 'color' and 'signal',
mySignal:'signal',
scriptLoaded: "string",
},
// The output ports of the Javascript node, name of output and type
outputs:{
// ExampleOutput:'string',
},
// All signal inputs need their own function with the corresponding name that
// will be run when a signal is received on the input.
mySignal:function(inputs,outputs) {
if (!inputs.scriptLoaded) {
return;
}
// ...
var node = document.querySelector('[title="test"]');
node.innerHTML=
'<a-assets>'+
'<a-asset-item id="tray-start-obj" src="./tray_start.obj"></a-asset-item>'+
'<a-asset-item id="tray-start-mtl" src="./tray_start.mtl"></a-asset-item>'+
'<a-asset-item id="slope2-obj" src="./slope2.obj"></a-asset-item>'+
'<a-asset-item id="slope2-mtl" src="./slope2.mtl"></a-asset-item>'+
'<a-asset-item id="tray-goal-obj" src="./tray_goal.obj"></a-asset-item>'+
'<a-asset-item id="tray-goal-mtl" src="./tray_goal.mtl"></a-asset-item>'+
  '</a-assets>'+
'<a-scene physics="debug:false;" background="color: #FAFAFA">'+
'<a-camera position="1 3 7"></a-camera>'+
'<a-sphere dynamic-body position="-3.9 6 0.1" scale="0.5 0.5 0.5"></a-sphere>'+
'<a-obj-model static-body scale="1 1 1" src="#tray-start-obj" mtl="#tray-start-mtl"></a-obj-model>'+
'<a-obj-model static-body scale="1 1 1" src="#slope2-obj" mtl="#slope2-mtl"></a-obj-model>'+
'<a-obj-model static-body scale="1 1 1" src="#tray-goal-obj" mtl="#tray-goal-mtl"></a-obj-model>'+
'</a-scene>';
},
// This function will be called when any of the inputs have changed
change:function(inputs,outputs) {
// ...
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment