1
$\begingroup$

After a half-day of work scouring the API (Blender 3.1), I couldn't quite find something that helps me solve my problem. Questions:

  1. How can I draw a custom grid floor?
  2. How can I create a custom snap option to snap to said custom grid?

My motivation is simple. I'm working with a 3D tile map, where each tile is inside a hexagon volume like so:

Hexagon Volume

When visualizing if each tile fits visually, it is nice to position them like they would be in a hex grid, in-game. The snapping tools work great with square tilemaps, but not hexes. So, the grid is the visual guide, and the snapping becomes obvious.

Ideally I'd like to put the snapping option under here:

Blender 3.1 Snapping Options

But wouldn't be bummed out if that's not possible.

NOTE: Just to make it clear, I'm not asking for the maths to implement those features just which API I could use to implement them myself. I'm happy to provide the source code later to others who find this helpful. The Grid is just a bonus. What I REALLY need, is a way to snap wherever I please.

$\endgroup$
3
  • 2
    $\begingroup$ A simple way to do is: create a lot of dot on the floor and snap to Vertex $\endgroup$
    – X Y
    Commented Mar 24, 2022 at 19:01
  • 1
    $\begingroup$ I don't think custom snap increment behaviour is exposed to the python API. +1 for X Y's suggestion to first create a vertex grid corresponding to the hexagonal tile centers and snap to vertex $\endgroup$
    – Gorgious
    Commented Mar 24, 2022 at 21:33
  • 1
    $\begingroup$ You could use geometry nodes also to create a grid. Maybe you can also just leave out the grid and just use a script to position the hexagons depending on your use case. $\endgroup$
    – Timmethy
    Commented Mar 24, 2022 at 22:09

1 Answer 1

2
$\begingroup$

To summarize all the good 3 comments of xy, Gorgious and Timmethy:

you could do it e.g. like this:

enter image description here

snap options:

enter image description here

result:

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Yep, this solves my problem neatly! Thank you everyone for the help $\endgroup$ Commented Mar 25, 2022 at 14:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .