Hello there,
I’m facing an annoying problem - mesh of player randomly disappears for like 0.1s, it’s like bliking. What’s weird, every other mesh does not do that. Haven’t you faced same problem? I’d appreciate some tips.
Hi @iHux3 and welcome to the forum. Is it possible to reproduce the problem in a playground? First Steps - Babylon.js Documentation
Hi @JohnK, I’d appreciate visiting https://d3d.glitch.me/ , the problem is right there. You can move with WASD, open 2 tabs and watch the models of players for few minutes and you should see them sometimes blinking.
First of all I have no expertise in using socket.io and there is a lot of code to go through. My suggestion would to try and isolate the area where the problem happens and try out a simplified version in the playground. Given that I do not have time to go through the whole code and have just had a quick glance the thinking that follows in little more than guess work.
Presuming that socket.io is feeding positional data back to the local computer then the data is causing the model to disappear. So at times the data is either saying dispose and recreate the model or the data is invalid in some way meaning the model cannot be rendered in some cycles or the data is positioning the model outside the viewable area.
What I would do is with a simple box as a model try out just the code that moves the model in the playground and see if that code produces a glitch. Perhaps the lerp function produces invalid data, for example.
Sorry I cannot be of more help. You may have to wait over the weekend for more knowledgeable people to view you question.
Thank you so much for your time, John. I’ve found the bug. It was in the lerp function, sometimes it set poisition to NaN, so it disappeared. I thought there was something bad with the BABYLON, but it was just my bad.