n5ro / aframe-physics-system

Physics system for A-Frame VR, built on CANNON.js.
https://n5ro.github.io/aframe-physics-system/
MIT License
505 stars 136 forks source link

Slight lag when adding dynamic entity to scene and turning camera #173

Open NVFedorov opened 3 years ago

NVFedorov commented 3 years ago

Hello, I'm not sure whether it's a bug or I'm doing something wrong, but when I open a scene on my phone and click on a button to add a dynamic sphere to the scene, there is a slight lag: the whole scene hangs for a noticeable moment before adding the sphere. The thing is when I tap the button and immediately release it, everything seems to be fine, but when I hold a button for like quarter of a second and move my phone, the scene hangs for the same amount of time. Looks like the "hold button" time and lag time are proportional.

I modified the orange cannon example to reproduce this behavior: https://glitch.com/~alkaline-hollow-breakfast Also I recorded a video: https://youtu.be/lo8ZiCuxa58

Update: Here is another example, but this one works pretty well. I used a clickable plane to launch spheres: https://glitch.com/~holly-sparkling-chronometer

But then a question comes: I need a static button which user can tap (not with cursor) and using something like aframe-mouse-cursor-component looks like an overkill. Is there a way to work it around?

Update 2: I figured out how to work it around: https://glitch.com/~acute-courageous-bus But still is it possible to have a smooth scene with non aframe button click?

kylebakerio commented 3 years ago

would be helpful if you opened the chrome performance profiling tools to get more detailed info on what was happening.