# Making a 3D jigsaw puzzle

**URL:** <https://forums.unrealengine.com/t/making-a-3d-jigsaw-puzzle/494205>\
**Category:** Community & Industry Discussion\
**Tags:** unreal-engine\
**Created:** [February 4, 2022, 1:01pm UTC](https://forums.unrealengine.com/t/making-a-3d-jigsaw-puzzle/494205 "2022-02-04T13:01:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattSug](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MattSug](https://forums.unrealengine.com/u/MattSug)\
**Post date:** [February 4, 2022, 1:01pm UTC](https://forums.unrealengine.com/t/making-a-3d-jigsaw-puzzle/494205/1 "2022-02-04T13:01:13Z")

</div>

I’m about to develop a simple VR jigsaw puzzle and I’m wondering what would be a good approach to this in unreal 4.27.

My thoughts are that I could create a framed area for the extent of the finished assembled puzzle, then create a matrix of sockets within this frame, which refers to the male and female parts of the puzzle pieces. Then create some simple logic to check if the piece of the puzzle is overlapping the correct socket. Would this approach work?

What would be another or better way of approaching this task?

---

<div class="post-metadata">

**Author:** ![Nawrot](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nawrot/32/618260_2.png) [@Nawrot](https://forums.unrealengine.com/u/Nawrot)\
**Post date:** [February 4, 2022, 1:41pm UTC](https://forums.unrealengine.com/t/making-a-3d-jigsaw-puzzle/494205/2 "2022-02-04T13:41:09Z")

</div>

Do not check if they are overlapping or not.  
Such puzzle is done on tiled like surface (ie all tiles are boxes with fancy edges).  
So instead give every tile x,y coordinate, and allow it to be placed only when its in corner, or has adjacent tile placed.  
Actual shapes of tile really do not matter, only their index on grid.

Then calculate coordinates based on x,y and just attach (or spawn component) at correct location relative to parent.

I know placing random pieces until they do stick would remove big part of joy with such puzzle, so you need to limit such cheating.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 4, 2022, 2:15pm UTC](https://forums.unrealengine.com/t/making-a-3d-jigsaw-puzzle/494205/3 "2022-02-04T14:15:53Z")

</div>

> [@MattSug](#):
>
> jigsaw puzzle

In case you’re looking for inspiration regarding how to chop up an image into XY pieces:

> [@can blueprints be used to chop an image into pieces?](https://forums.unrealengine.com/t/can-blueprints-be-used-to-chop-an-image-into-pieces/104930/2):
>
> See if you can adapt the following to your needs: A material for the actors. It takes 3 scalar values - U, V and Size. UV is going to shift the coordinate and Size dictates the number of pieces. A \*PuzzlePiece \*actor that has a simple cube (with Z scaled down to make it flat), a Dynamic Material Instance is going to be fed data when the actor is spawned - the U, V and Size are variables ExposedOnSpawn The \*LevelBlueprint \*spawns PuzzlePieces. The 2D …

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [February 4, 2022, 6:21pm UTC](https://forums.unrealengine.com/t/making-a-3d-jigsaw-puzzle/494205/4 "2022-02-04T18:21:48Z")

</div>

My go to for this would be doubled up piece checking.

If it’s drag and drop - which let’s be real, it’s the only decent way to make puzzle tiles end up in the correct place - then the solution is as simple as having an invisible puzzle solution on the table, properly solved.

The mouse pointer (or center of used tile) runs a trace and checks for the piece name or a gameplay tag.  
If that matches the piece you are dragging, it “does things”.

Does things,  
Because placing in the tile at the right spot for the user is a bad idea.  
But you can keep count of if it was in the “right spot” and maybe force align it and any other pieces marked as “right” once the 3 adjacent ones are placed.

Always, force align edge pieces. And probably always snap correct pieces to the edge piece.

All in all, it’s a cheap trick solution that just works, when you have a set solution…
