Pickable (mouse clicking) hex tiles.

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
Natalo77
Gnoblar
Posts: 1
Joined: Fri Apr 19, 2019 3:57 pm

Pickable (mouse clicking) hex tiles.

Post by Natalo77 » Thu Apr 25, 2019 8:00 pm

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
0 x

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1064
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 83

Re: Pickable (mouse clicking) hex tiles.

Post by xrgo » Thu Apr 25, 2019 9:50 pm

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)
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 905
Joined: Sun Mar 30, 2014 2:51 pm
x 195
Contact:

Re: Pickable (mouse clicking) hex tiles.

Post by paroj » Fri Apr 26, 2019 10:52 am

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).
0 x

Post Reply