简体   繁体   中英

Unable to check the rotation of items in AFrame

I'm trying to write a AFrame component that checks the rotation of an object. However, I am unsure of how to write the if statement to check.

I already know that the rotation attribute returns a the x,y,z in a set. However I am unsure of how to check it.

var rotation = document.querySelector('#checkItem').getAttribute('rotation');

if (rotation === {x: 0, y: 90, z: 00}) {
   document.querySelector('#key').setAttribute('visible');
}


在JS中,您必须检查各个属性:

if (rotation.x === 0 && rotation.y === 90 && rotation.z === 0) { ... }

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM