what should be done to get picking work for TerrainTest?
i mean when mouse moves to some point and user clicks and Node of that terrain will change it’s colour to highlight it’s selected.
what should be done to get picking work for TerrainTest?
i mean when mouse moves to some point and user clicks and Node of that terrain will change it’s colour to highlight it’s selected.
Do you mean to select one of the IndexedTriangleArray’s which make up the terrain in Michael Wright’s Demo?
Just a thought but if you could set the Shape3D which displays the IndexedTriangleArray which defines the terrain to piackable - I think it’s in the TerrainShape() constructor - then you just set its colour when you click it?
Sorry if that doesn’t make much sense, I’m new to xith. 
currently i setted TerrainShape.setPickable(true) but when i try to view.pick(canvas, mouseX, mouseY, 3, 3);
it returns array size as 0.
i’m trying to port my very old SimCity clone to use xith but no luck with this…
so you remember those old SimCity’s? where you select a tool(lets pick residential zone) and user moves mouse to cell and clicks and cell changes to residential cell…
that’s my goal but no luck with it…
I don’t know the Terrain classes but if you want to be able to pick something with Xith3d, please make sure all the Nodes containing your final Shape3D have been setPickable(true) too, including the top scenegraph node.
[quote]currently i setted TerrainShape.setPickable(true) but when i try to view.pick(canvas, mouseX, mouseY, 3, 3);
it returns array size as 0.
i’m trying to port my very old SimCity clone to use xith but no luck with this…
so you remember those old SimCity’s? where you select a tool(lets pick residential zone) and user moves mouse to cell and clicks and cell changes to residential cell…
that’s my goal but no luck with it…
[/quote]
I want to do something similar with a modified version of the Xith terrain. I think even if your setPickable() code returned a value, it would not do what you expect because the TerrainShape as a whole would be pickable, you’d only be able to know if the terrain was clicked or not. You would not know where the terrain was clicked.
One of the things I’m trying to figure out now is how to retrieve which triangle was clicked. I have a height map and I would like to display coordinates and elevation at the point under the mouse when the right mouse button is clicked and held. So far, it doesn’t look like the example code is going to work for this without a lot of modification.