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:
A collision detect between each piece of the puzzle
If it’s the correct piece it will snap with the other
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.
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()
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?
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
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?
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.
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)
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.
There are multiple ways to solve this of course. The easiest one might be just putting a sift node between hittest and the s+h. Sift for “1” and set the find pin to “last” so you get always the frontmost piece. Also connect your color switch to the sift node rather than the hittest so you highlight just the piece you are about to move.