Hello, I’m facing an issue with simple 2D Sprite rendering.
Basically, I try to render a simple image in a 3D scene with a SpriteManager and a Sprite however when I render the scene, instead of showing the proper image, it shows a black & red tiled image. The image won’t show up. Yet, the image path is correct on my VSC project, for the SpriteManager, there is “1” cell, and the dimension set to 1000px (square dimension of my image), the image is in PNG format.
Since I’m starting learning Babylon JS, is there something that I’m missing? Thank you for helping me.
const spriteManager = new B.SpriteManager("playerManager", "textures/mr_stick.png", 1, 1000, scene);
const playerSprite = new B.Sprite("playerSprite", spriteManager);
playerSprite.size = 1;
playerSprite.position = new B.Vector3(0, .5, 0);
It still doesn’t work. By opening the inspector in Sources tab under the localhost:1234 drop down, I can’t see the image file so I believe somehow it is not in the localhost files. I have no idea why it doesn’t take in count the image but I tried all the possible paths that could work or not, but the path is just a simple ./ which means being in the same folder.
Ok I will follow that then. I think that light be an issue with the project installation process from the tutorial because my friends also have followed this tutorial and have the same issue. Thank you for your help, >i appreciate it.
If you follow the tutorial word for word it does not use a copy plugin so you would not have had access to this information. I’m fairly sure this is what it is.
If you don’t see your textures in your dist folder where you expect them then it will not work period with the way you are doing it. The “./” starts at that directory so if you do this I’m highly confident it will work.