Jump to content

Sprites not showing up


MinZe
 Share

Recommended Posts

Hi, I'm trying use sprites but they are not showing up and no error is displayed.

this is the typescript code

o.spriteManager = new BABYLON.SpriteManager('circleManager', 'https://i.imgur.com/kzDwQjO.png', 2000, 512, o.scene);
o.spriteManager.renderingGroupId = 2;
const a = new BABYLON.Sprite('p01Circle ' + options.name, o.spriteManager);
// const a.stopAnimation();
// const a.cellIndex = 0;
a.width = 100000;
a.height = 100000;

And in this playground I have almost the same, but it's not working:

https://www.babylonjs-playground.com/#9RI8CG#33 (sprites demo playground but with the url changed)

this is the code on the playground, this one works


    var spriteManagerTrees = new BABYLON.SpriteManager("treesManager", "https://i.imgur.com/kzDwQjO.png", 2000, 512, scene);

    //We create 2000 trees at random positions
    for (var i = 0; i < 10; i++) {
        var tree = new BABYLON.Sprite("tree", spriteManagerTrees);
        tree.position.x = Math.random() * 100 - 50;
        tree.position.z = Math.random() * 100 - 50;
        tree.isPickable = true;
        tree.size = 10;

        //Some "dead" trees
        if (Math.round(Math.random() * 5) === 0) {
            tree.angle = Math.PI * 90 / 180;
            tree.position.y = -0.3;
        }
    }

What can I do to solve it?

Link to comment
Share on other sites

Okay, it seems the problem is on the rendering group. If I comment the 

        // spriteManager.renderingGroupId = 2

it works perfectly.

But I really need to be rendered the last thing, I need the sprite to be always over the meshes

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...