I got a tiled map (.tmx file).There are 45 * 31 tiles in a TileLayer, every tile in that TileLayer sharing one image. For each tile, I create a quad mesh and apply the same material to it. Then I attached them to a BatchNode.
I set the queue bucket to Bucket.Gui for every Geometry and Node, and move the scene to screen space (XOY plane, 0<x<width, 0<y<height) so I can see the map.
Were you dragging the batch node or the children of the batch node? I’m just wondering.
And yes, there are a dozen reasons that batch node is not a good idea in your case. The best way would be not to use quads at all and just build your own batched mesh. Then you control everything and it’s not that hard, really.
Yeah, that’s what I was afraid of. I think BatchNode is not efficiently implemented with respect to parent and child transforms. If it was setup better then dragging the BatchNode (or its parents) shouldn’t cause all of that resetting of the transforms.
If you make your own mesh then that wouldn’t be a problem.
…but ultimately, you will be happiest with your own mesh as you will be able to do everything you want. It’s not really that hard once you get the hang of it. It’s conceptually just an array of points. (And another array of texture coordinates, etc…)
The SimpleBatchNode avoid this issue, though you can’t have complex sub graph below the SimpleBatchNode, so all the geometries has to be attached to it directly.
I use this and well abuse the hell out of it. I have no performance issues. I even have a lot of polygon detail that should be baked into normal maps. I put the entire map on the scene at once without LOD! And still i have very few performance issues even on intel onboard gfx cards. In fact i only drop below 60fps when i add a bunch of post processing filters.
For this reason i am finding it hard to justify writing my own. I know it wouldn’t be hard. After all i have done my own terrain system in opengl before with vertex shader based LOD etc. But why fix what is not broke
In OPs case, for a tile system I imagine it is sometimes important to swap out tiles at runtime. In that case, having access to a mesh you made yourself would be very beneficial as you could surgically replace the tile you want without rebatching the whole thing.