my objects are randomly disappearing and i dont know why. I hope someone can help me
For reference: They started disappearing, once i started cloning the box 100 times just for fun
// ****************** Box ******************
var box = new BoxEntity();
// Default box Copy
let boxTemplate = box.entity.clone();
// Multiplying the boxes with the defualt copy and attaching to the box object
for (let i = 0; i < 100; i++) {
let boxClone = boxTemplate.clone();
boxClone.translate(0, i, 0);
box.entity.addChild(boxClone)
}
// Add all the boxes to the scene
app.root.addChild(box.entity);
I think it might be a performance glitch or something. Since you have about a 100 boxes just entering the scene, the game get’s a little confused & starts glitching out like that. Usually from what I heard of, games tend to render things when they’re in your view to save on memory & performance. But since all the boxes started cloning at the same time. The game might get confused, thus glitching out a bit. I’m not sure about this answer though, just something I thought made sense. Maybe try cloning less entities in a scene at once. If that doesn’t work, try getting in contact with @yaustar or @will.
Without seeing the rest of the code, it’s hard to tell. However, it’s a bit odd that you are adding the cloned boxes as children of the original box entity.
Ye i realized it myself. Should have just made another entity and attach it to that. That way it also works. Maybe just bad karma for making spaghetti code