• 2D
  • How to make a collision hexagon shape

Hi Here my solution to make a collision hexagon shape:

The trick is to use apothem https://en.wikipedia.org/wiki/Apothem

  • having 1 as circumradius with this formula cos(pi/6) we will found the apothem (its a fixed number, for hexagon is 0,866)

It would be nice if Godot will implement hexagon collision shape. (Hexagon shape it is one of the most used shape in any game-engine/design software) Its not difficult to obtain using ConvexPolygonShape but it will be easy to have it already prepared where people need to resize it only.

What do you think? It is useful to have it in Godot?

It could be useful, especially for isometric games. I'd open a proposal on the Godot proposal repository and see if there is interest in adding it into the Godot core.

@TwistedTwigleg said: It could be useful, especially for isometric games. I'd open a proposal on the Godot proposal repository and see if there is interest in adding it into the Godot core.

Good luck with that :) I tried but seems someone in charge closed my request. So i wrote here to gather consent ;) Maybe if you can write it in a beautiful English language... I'm not native English :) https://github.com/godotengine/godot-proposals/issues/663

Looking at the proposal, it looks like it was closed due to not having the template filled out.

Unfortunately, as I am mostly a 3D game developer, I'm not sure I would be able to fill out the "If this enhancement will not be used often, can it be worked around with a few lines of script?" section. From a code point of view, it might be easy enough that a simple plugin could be made that accomplishes the same thing by auto populating a collision shape. I dunno, I'd have to mess around with it to have an idea of how easy it would be to work around using a script, and until then, I do not think I could properly fill out the proposal (so one I opened would likely also be closed).

I've made my fair share plugins so you can believe me when I say that this can easily be achieved in Godot as it is. It doesn't even need to be a plugin. Just a script with a class name would suffice. So having it in the main engine's code isn't really necessary.

I did so in short is not something I need for myself. My point is: among all Godot users there are a part that are not developers. This shape is widely request/used in game engines. We have to think for the future and for other people not just for us. Obviously it is not urgent but I think it is necessary to be core. Also.. because is so simple even more so have to be implemented. It will not take long to be implemented. Right? If they need a big effort mean something is wrong somewhere :)

There's a saying used in the Godot development community that goes something like this. "If it can be done in an add-on, then it can stay as an add-on".

While the feature you are proposing is definitely useful, it doesn't need to be in the Godot core taking up space. It can be done in script, and anyone can use it like that.

If you insist on it being in the core, then you should explain why making it a part of the engine is any much better than having it as a plugin.

@Vale-git said: This shape is widely request/used in game engines.

And you say that this shape is widely used. Could you give at least three use cases? Googling "hexagon collision shape" doesn't give as many results as circle or square. :/

Plugin -> Asset library. Not everything has to be bundled in 'core'. That's how you end up with the super bloated toolkits.

https://docs.unity3d.com/Manual/Tilemap-Hexagonal.html Unity have it already.. We no need? https://itch.io/games/genre-strategy/tag-hexagon https://www.slant.co/topics/6519/~hex-grid-games-on-steam#3 https://www.polygon.com/deals/2019/1/24/18185901/strategy-tabletop-board-games-catan-scythe I see a few games in hexagon shape here. Don't tell me that all of them use a square or circle collision shape?

If I say there are endless possibility to use it in any game do you believe me?

As I said is not urgent - ok maybe for me because I have a plan to make a 2.5 game :) - but it is useful for sure and in my opinion is a must in any game engine as core.

I can imagine to make an hexagonal tile map in a couple of mouse click how it will be awesome :) My idea start from this picture:

It came from a moba game made in untity (prime world). All collisions shape of them are hexagonal so it was easy to deploy in field in ordered manner that will be difficult to obtain same result using circle or square shape.

Well, if you need it anyways and are going to be developing it you can always make a pull request to the godot repo for it's inclusion.

I tried once to debug godot code - was for pathfinder - .. honestly it is better to do it for someone who already know where can touch :) . But anyway what I was asking is solely to make a proposal in github. If one day I will be the one who will make it who knows. In this moment I feel not confident enough.

Look here how beautiful is this: Everyone know catan right?