Don't call raycaster setDirty on each mouse move unnecessarily#5542
Don't call raycaster setDirty on each mouse move unnecessarily#5542dmarcos merged 1 commit intoaframevr:masterfrom
Conversation
…and not on every mouse move (setAttribute('raycaster', {origin, direction}) is called by the cursor component in onMouseMove triggering refreshObjects on each tick with the default raycaster refresh interval that is 0)
|
That issue is actually new in aframe 1.6.0. It wasn't an issue in 1.5.0. |
|
You can test on the http://localhost:8080/showcase/ui/ example, put a console.log in raycaster refreshObjects function. |
|
Prior to 1.6.0 the handling of instances of classes like Looking at the |
|
Thanks so much! |
Description:
Before this PR,
setAttribute('raycaster', {origin, direction})is called by thecursorcomponent inonMouseMovetriggering raycaster update method andthis.setDirty()so actually callingraycaster.refreshObjects()on every tick with the default raycaster refresh interval that is 0, or every 100ms minimum if you set raycaster interval to 100 for example, even if nothing changed in the scene.Some notes:
this.el.setAttribute('raycaster', rayCasterConfig)was introduced in 2017-07-18 22:28 in a4b91bcrefreshObjectsdirectly before that.Changes proposed:
raycasterupdate, callthis.setDirty()only ifobjectsproperty changed