3D puzzle


#1

Hey VVVVers,

Well, back to the forum again.

I would like to do a 3D puzzle. At the moment I’m using an online puzzle through the HTMLTexture DX11. I have some limitations with that so I would like to do it entirely in VVVV

What basically I need to achieve:

  1. A collision detect between each piece of the puzzle
  2. If it’s the correct piece it will snap with the other
  3. Understand when it’s complete

BONUS: End up with a contribution so someone else in the future will find it easier.

So I have rough draft in my mind on how to approach this but I would like to hear your opinion and your approach that would probably be more helpful and fast than mine.

P.S I don’t have a clue about VL

P.S 2 It’s going to be touch installation.

Cheers


#2

there are so many ways, i think if you want to have physics in there bullet is your way

you can use bvh to add custom collision shapes
there is a raycast, so you can pick up picies

i’m not sure about stability but i think it’s a matter of tweaking a friction


#3

Eh,
if the piece is left from "grasp": if the piece is over its coords: if there's another correctly placed piece in any surrounding coord: piece2pieceSnapAnimation()


#4

@antokhio , That’s the question. Do we need physics to implement a 3D puzzle? It could provide more features but is it needed?

@h99 Like the logic of that, don’t know how to use it.

These could be a start.


#5


#6

Ok so how to detect the collision between the parts? any way it will be acceptable.

with 3d select contribution I’m able to detect the collision between the “hit” and the parts but how can i detect when one part has a collision with the other parts?


#7

The actual question is what would you like to get from this collision? (Data or effect)

Actual mesh collision detection is an physics engine feature.

You should prolly start by having somekind of invisible solved puzzle in scene, so you can get some final xyz of fragment, so you check if pice is near it’s final position.

Basically you can run twice the 3d select contrib, first time against your actual pices, second time against final result.

Attaching some pices together and moving them attached is bit of


#8

well I actually want both…data and effect…

data so I can know when they collide and the effect of attaching them together.

I will do the pipeline you suggest, the twice run of 3d select with an invisible solved puzzle and see the next step from there


#9

OK so I skipped the collision part for now and tried to achieve the movement.

As you can see in the video I uploaded two of the pieces are matching with the mouse pointer but the other two are getting offset when I click on them. Any clues? Any tips?

record_000003.zip (2.4 MB)


#10

So basically when I map the coordinates of the XY (mouse) with the transformation of the puzzles it changes their position? but even if i connect direct the XY of the mouse to the transformation it still offsets the pieces. so whatever I do I get the offset. it’s not the aspect ratio because it’s connected to all necessary points

edit…So I found the issue…The problem was that I was changing the piece coordinates with the mouse coordinates but when I dropped the piece somewhere in the screen and then try to pick it up again it was offsetting the difference between last drop and new pick up…So a solution I found was to: Get the XY coordinates of the piece and subtract them from the XY coordinates of the mouse. After that I was feeding it to the transformation.

It works BUT.

The Issue is that is flickering between the two distances (probably is because is doing the subtract all the time) and it’s not stable.

What I thought is that when you pick up the piece, it will do the subtract at that frame and then switch to the XY coordinates of the mouse. I did manually and it works. Now I need to it automatically.


#11

i would recommend moving the pieces by framedifference. That way you dont have to care about mouse position vs object center and such stuff. see my attempt at puzzeling with quads. quite fun thing to patch.
drag quads by framedifference.v4p (21.7 KB)


#12

Hey tgd,

Thank for the patch.
They not moving thought… did I missed anything?

You haven’t connect hittest points xy with the mouse xy…I did it but they not moving again.


#13

huh, saved everything connected, strange. mouse XY needs to be connected to hittetst and framedifference.
i was patching it with an alpha but the mouseXY pin has changed naming there. that might be the problem.
sorry, as it is the part the patch is all about :) just reconnect, should be good.