Search the Community
Showing results for tags 'delete'.
-
// Bullet if(this.CurrentAnim.name == "bullet_dead") this.CurrentAnim.Animsprite.onComplete = () => { this.IsDead = true; }; // Animation (animation class have member pixijs.animsprite) this.update = function() // update is game loop { if(!this.loop) { this.Animsprite.onComplete = () => { this.stopAnim(); // stop anim delete this; // delete animation obj }; } } // GameScene if(this.arrGameObj[i][j].IsDead) // every loop check dead obj and remove it { delete this.arrGameObj[i][j]; // to null, release in memory this.arrGameObj[i].splice(j); // pop in arrgameobj continue; } // Here's recorded video that help you understand my problem clearly 2022-12-12 16-07-27.mkv
-
Hi everyone, A bit of a babylon philosophical question here. I want to deal with a massive amount of spheres, and want to keep it as smooth as possible. I thought I would hide spheres which are no longer in the view frustum. Now that I got that code, I wonder what is the most efficient, either to hide the meshes by selecting and applying .visibility = 0, or if it is better to dispose of the meshes ? If you're curious, in my case I only rotate the camera and don't move it, and I know what I have to show thanks to the angles within a database. Currently, Babylon still feels a bit too slow to my taste with many elements hidden. Should I change my code to dispose of the meshes and recreate them instead of hiding/showing ? Best, Kevin
-
Hi, to prevent memory leak, I want to delete unused texture. What is the proper way to do it? Let's say I created texture : var button = PIXI.Texture.fromCanvas(canvas); Later in the code i want to do something like this : button.destroy(); // really delete texture from memory button = PIXI.Texture.fromCanvas(canvas); // newly created texture Thanks in advance, -bubamara