PhasedEvolution Posted September 11, 2016 Share Posted September 11, 2016 Hello. I am new to babylon.js. I have used phaser before for isometric. I want to create a isometric tiled map, similar to this in babylon. I have set up an isometric camera view with setTarget at ground.position (I created a ground). I want a similar view the one on the image. I don't actually know how do you generate isometric maps like those in babylon. Is with a for loop like: For some reason the tiles are spawning all in the same place despite xx and zz being always different. function spawnGrassTiles (half_tile_width,half_tile_height,size_x,size_y) { for (var xx = 0; xx < size_x; xx += half_tile_width) { for (var zz = 0; zz < size_y; zz += half_tile_height) { var grass_tile = new BABYLON.Sprite("grass_tiles", grassTilesCreator); grass_tile.position.x = xx; grass_tile.position.z = zz; } } } // do I need to specify the y position? Or do I create a ground and edit it somehow? Thank you nazimboudeffa 1 Quote Link to comment Share on other sites More sharing options...
nazimboudeffa Posted September 11, 2016 Share Posted September 11, 2016 I am interested in any continuation but i don't know if i have to switch to babylonejs for the moment thx for the question propositions it would be nice to add this tree to the grass tiles http://codepen.io/featuresmega/pen/WGQEaw and to have a pen just for the ground Quote Link to comment Share on other sites More sharing options...
Milton Posted September 12, 2016 Share Posted September 12, 2016 Using Sprites in a 3D engine sort of defeats the purpose you're looking for. Use meshes for your tiles, and sprites for eye candy. For an Isometric example, take a look at this. Concerning your actual problem, maybe it's a scale/zoom thing? Ask @Deltakosh nazimboudeffa and PhasedEvolution 2 Quote Link to comment Share on other sites More sharing options...
PhasedEvolution Posted September 12, 2016 Author Share Posted September 12, 2016 2 hours ago, Milton said: Using Sprites in a 3D engine sort of defeats the purpose you're looking for. Use meshes for your tiles, and sprites for eye candy. For an Isometric example, take a look at this. Concerning your actual problem, maybe it's a scale/zoom thing? Ask @Deltakosh I know about meshes. I just didn't know you do "tilemaps" with them in 3D engines... Is it the same logic? Just exchange the tiles for meshes with a texture? I think you are right. It is a problem of zoom because the values I did console.log (the coordinates) were very small (0.0121, etc). I need to change the camera zoom or something like that I think. As for isometric example you linked it doesn't seem to load because it can't find some of the assets (I don't know if it is because of that, just saw it on the console). I get a black screen with a loading. Quote Link to comment Share on other sites More sharing options...
Milton Posted September 12, 2016 Share Posted September 12, 2016 Hmm, the example works fine for me. Just download the zip, unzip it in your www directory, and behold: This is the perfect example of how to make an Isometric game. TileMap is just a 2D render term. It means uploading all Tile images to the GPU, and then whatever you draw, it can do it *fast*. A 'tilemap' in 3D just means you have some sort of internal representation of what your world is supposed to look like. It has *nothing* to do with your renderer. You can load a Tiled map, but you'll have to do the rest yourself. PhasedEvolution 1 Quote Link to comment Share on other sites More sharing options...
PhasedEvolution Posted September 12, 2016 Author Share Posted September 12, 2016 I think I got the concept... well the game is structured in a different way than what I am used to see (not that I have seen lots of things already :D). I haven't still been able to run the game but I am exploring the files and trying to adapt the logic to my purposes. Anyway the errors I am getting when running are these: Quote Link to comment Share on other sites More sharing options...
Milton Posted September 12, 2016 Share Posted September 12, 2016 You do not seem to be using a web server? You can't just double click index.html... Look at this. Quote Link to comment Share on other sites More sharing options...
PhasedEvolution Posted September 12, 2016 Author Share Posted September 12, 2016 Yeah I have seen that... Well in phaser I used to run with in internet explorer and it just loaded the game entirely with no errors and so I moved with that. And I also thought since it was a local file would matter nothing... Well just installed mongoose, seems fine 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.