mozilla / aframe-xr

INACTIVE - http://mzl.la/ghe-archive - System / Components to build WebXR experiences with A-frame
https://mozilla.github.io/aframe-xr/
MIT License
184 stars 36 forks source link

Avoid creating objects in reticle and xranchor components #19

Closed vincentfretin closed 3 months ago

vincentfretin commented 6 years ago

I optimized the reticle and xranchor components to not create objects on each frame. I tested the reticle component. I did not test xranchor component, so be sure to test it before merge.

blairmacintyre commented 6 years ago

There used to be a difference between changing these with "setAttribute" (which would update the component values AND set the object3D properties) and just setting the properties directly. Setting the object3D directly wouldn't update the component values.

For example, if a different component wants to look at the rotation or position of an aframe entity, and it get's the property of the corresponding component, in this changed version, it wouldn't see the new values since you are just setting them directly and not calling setAttribute.

Do newer versions of AFrame fix this? (I admit I haven't been paying too close attention to AFrame internals in months).

vincentfretin commented 6 years ago

This has indeed changed in aframe 0.8.2. setAttribute or getAttribute set or retrieve position, rotation or visible directly on object3D now.

vincentfretin commented 6 years ago

The behavior you described was indeed an issue on aframe 0.7.1. This is not the case on aframe 0.8.2.