Hello!
So I have a classic puzzle game er... puzzle in my game where you basically have to fit a number of pieces together (like pieces of a treasure map let's say)
These pieces you collect from around the game and carry them in your inventory and the idea is that when you interact with a special object/hotspot in the game you can drag and drop these pieces from your inventory and fit them together on this hotspot (so imagine a special table or something)
Does anyone have any pointers about how to do this using AC? Or am I better off bypassing AC in this case? Even if bypassing it is the way to go I kinda need to mix and match as I need to be able to drag and drop these pieces from my inventory in this special "puzzle game" screen (so I need the inventory at least to be active here)
At the moment I am using a camera switch to switch to this table and I also have a fake UI with a single "Go Back" button (which takes me back to the main game. So that works quite well (apart from the fact that I get the Use icon when I hover on the Go Back button - makes sense as I used a hotspot to implement that - any way to suppress the icon in this case?)
So zooming in and out of the table screen works great, now I just need to figure out how I can drop these pieces from my inventory and have the ability to drag them around and rotate them so I can implement this puzzle logic.
Any pointers much appreciated!
Comments
- Make the board/table where the puzzle takes place a Hotspot, that has an Inventory interaction for each puzzle piece. That way, you can drag and drop your Inventory items onto it, and have a reaction.
- Each time you use an item on the board, remove it from your inventory, and make visible a scene-based representation of it (e.g. a "map piece" mesh).
- Convert these scene objects to Draggable objects (add a Draggable into the scene, attach the mesh as a child), and use the Draggable script inspector to change the "Drag mode" to Move Along Plane. Then assign a plane for 2D movement, and you'll be able to drag the piece around the table (even if the camera is viewing the table at an angle)
- Use Triggers for each grid slot that pieces can be placed, which are set to detect only the one object that should be in that place. Once a piece is in the correct place, you can use the Object: Send message Action to disable it from further movement.
Hope that made sense - it should work in principle! If you have more questions, better to post some screenshots for us to work with.Oh btw, in case anyone else needs to do something similar, I just realised I missed something crucial from my previous description:
The "target" marker where the piece needs to go once it's teleported, is set a few units in negative z so that it is on top of the hotspot that corresponds to the board (I am using an orthographic camera so this is fine). This way once the piece appears on the board it will "hide" the board hotspot in the area where the piece's collider is active, so any picking/raycasting that you do will be captured correctly by your custom object.