1
\$\begingroup\$

First of all a little premise: I'm following this tutorial on YouTube for procedural 2d cave generation in unity using cellular automata and I'm extending it in order to make caves in all three dimensions. With this approach, caves are based on a 3d matrix where if a cell value is 1 it is a wall and if 0 it is an empty space. The "rooms" created, after being logically connected, need to be "physically" connected by making a path of zeros in the 3d matrix and the tutorial explains how to do this in 2d.

Can you, please, suggest me the approach on how to draw a discrete line (of zeros in this case), in a 3d matrix, that goes from point A to point B?

I'll attach a screen of a map example where rooms are drawn with cubes and red lines are the logical connections.

Screenshot of a generated cave

\$\endgroup\$
3
  • 3
    \$\begingroup\$ Bresenham's line drawing algorithm, originally in 2D, has been revised in many places with a 3D version. \$\endgroup\$ Commented Feb 5, 2019 at 0:02
  • \$\begingroup\$ I would bet that a DDA line algorithm could also work in 3D. \$\endgroup\$ Commented Feb 5, 2019 at 6:57
  • 1
    \$\begingroup\$ Bresenham is more efficient that DDA. \$\endgroup\$ Commented Feb 5, 2019 at 18:26

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.