Hello everyone,
I think I might have discovered a bug regarding Sprite rendering. The issue only appears when I try to render a Sprite whilst an instantiated model is moving within the scene.
This is how I am instantiating the model into the scene
const model = await SceneLoader.LoadAssetContainerAsync(`./assets/${path}`, 'my_model.glb', scene);
const modelMesh = model.instantiateModelsToScene('some_name').rootNodes[0]
and this is the code for the Sprite
const spriteManager = new SpriteManager('some_other_name', './assets/explosion_01-min.png', 64, 256, scene);
const sprite = new Sprite(`explosion-${Date.now()}`, spriteManager);
sprite.width = 10;
sprite.height = 10;
sprite.position.y = 0;
sprite.position.x = x;
sprite.position.z = y;
sprite.disposeWhenFinishedAnimating = true;
The weird part is that when instead of an instantiated model, I simply use a box (from MeshBuilder.CreateBox), everything renders as expected.
I’ve also attached some screen grabs to show the issue in action.
Am I doing something wrong? Or is this a bug? The question is, why does it work with a regular mesh but it doesn’t with the instantiated model.
BTW, the fact that the sprite is being animated is irrelevant. It is also happening when I use a sprite without any animations whatsoever.
Model standing still (sprite renders just fine):
Moving model (sprite fails to render here):
Box standing still (sprite renders just fine):
Moving box (sprite renders just fine):