I have created a custom look-controls and I want to add it to the scene using 'setAttribute(componentName, data)' but I don't know what to fill in parameters. Any ideas ?
Here is my attempt:
var skyImage = document.querySelector('#sky') as HTMLImageElement;
var aScene = document.querySelector("a-scene");
if(skyImage.complete){
if(skyImage.width/2 == skyImage.height){
let camera = document.createElement('a-camera');
camera.setAttribute('new-controls', 'true');
aScene.appendChild(camera);
for the custom look-controls, I took the same code, just limited the rotation to the Y-axis and renamed it to new-controls.
You either need to specify the property you want to change:
el.setAttribute('mycomponent', 'someproperty', value)
or, if you want to attach the component with default values:
el.setAttribute('mycomponent', '')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.