DylanD Posted August 8, 2018 Share Posted August 8, 2018 Hello again everyone! I was wondering if there was a way to get all the sprites in a sprite sheet automatically like they do here http://doc.babylonjs.com/babylon101/sprites but with sprites that are not uniform size (cellSize is not uniform). I know I could manually do it but I have many sprites and that could be very time consuming, and very messy. So I'm hoping there is a way to have sprite manager automatically make the cells. Any ideas? Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted August 8, 2018 Share Posted August 8, 2018 not without a json mapping or something of the sprites, something needs to tell where each sprite start & end uniform sprite sheets can be done like that because you just add the sprite size each time you need to find the next one. DylanD 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2018 Share Posted August 8, 2018 Quote from the doc: Quote Starting with Babylon.js v2.1, you can define sprite's width and height: player.width = 0.3; player.height = 0.4; Quote Link to comment Share on other sites More sharing options...
Guest Posted August 8, 2018 Share Posted August 8, 2018 You can also directly define manager.cellWidth and manager.cellHeight Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted August 8, 2018 Share Posted August 8, 2018 Oh i thought you ment a spritesheet where different sprites have different sizes? like there might be a man 100x100 and then a tree 100x200 DylanD 1 Quote Link to comment Share on other sites More sharing options...
DylanD Posted August 8, 2018 Author Share Posted August 8, 2018 11 minutes ago, aWeirdo said: Oh i thought you ment a spritesheet where different sprites have different sizes? like there might be a man 100x100 and then a tree 100x200 yes this is what I meant. 40 minutes ago, aWeirdo said: not without a json mapping or something of the sprites, something needs to tell where each sprite start & end uniform sprite sheets can be done like that because you just add the sprite size each time you need to find the next one. How could I do a json mapping ? 20 minutes ago, Deltakosh said: You can also directly define manager.cellWidth and manager.cellHeight 22 minutes ago, Deltakosh said: Quote from the doc: I have tried this but its all manual... Thanks for the response though. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted August 8, 2018 Share Posted August 8, 2018 often, spritesheet editing/creation tools have json exports.. (they map the sprites as you add them to the sheet) but i don't think you can automaticly create them from an already finished spritesheet, it simply would have no way of telling where one starts and the next ends. Quote Link to comment Share on other sites More sharing options...
DylanD Posted August 8, 2018 Author Share Posted August 8, 2018 Just now, aWeirdo said: often, spritesheet editing/creation tools have json exports.. (they map the sprites as you add them to the sheet) but i don't think you can automaticly create them from an already finished spritesheet, it simply would have no way of telling where one starts and the next ends. oh. A .png.meta file wouldn't have this information would it? Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted August 8, 2018 Share Posted August 8, 2018 2 minutes ago, DylanD said: oh. A .png.meta file wouldn't have this information would it? I don't know, sorry, but sounds like it might be worth researching. i hope you figured it out Quote Link to comment Share on other sites More sharing options...
DylanD Posted August 8, 2018 Author Share Posted August 8, 2018 6 minutes ago, aWeirdo said: I don't know, sorry, but sounds like it might be worth researching. i hope you figured it out Thanks! I will look into it! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.