Page 1 of 1

Pickable (mouse clicking) hex tiles.

Posted: Thu Apr 25, 2019 8:00 pm
by Natalo77
Hi.

My overarching idea is to have a n*n grid of hex tiles which an AI agent will then navigate to a goal tile on.

The main point is that the user can specify the tile type. I.E. there will be mountains, hills, plains etc.

They specify this by clicking on the tile, which then changes to the next type.

What Ogre objects should I be using for this?

The reason I ask is that static geometry won't work due to the individual tiles being unattainable, however individual scene nodes will be excessive for them.

I am using the raycasting to the polygon level algorithm given here: http://wiki.ogre3d.org/Raycasting+to+the+polygon+level

Re: Pickable (mouse clicking) hex tiles.

Posted: Thu Apr 25, 2019 9:50 pm
by xrgo
I think raycast to polygon is overkill for something like a tile... tiles are almost perfect fit of its bounding box, so a simple raycast should work. you are right in the fact that would be a lot of scene nodes, but if they are static should be no problem (at least in Ogre 2.X)

Re: Pickable (mouse clicking) hex tiles.

Posted: Fri Apr 26, 2019 10:52 am
by paroj
Natalo77 wrote:
Thu Apr 25, 2019 8:00 pm
I am using the raycasting to the polygon level algorithm given here: http://wiki.ogre3d.org/Raycasting+to+the+polygon+level
this is the best thing you can do.

Even in 2.x creating an item for the 4 triangles of your hex tile would waste a lot of memory as the meta-data would by far out-weight the actual data. Also testing against 6 sides of an AABB requires more computation (besides not being a good fit for a hex tile).