Forum rules - please read before posting.

Draggable documentation

Hi there,

Is there more documentation about draggables? When I look in the manual I see a lot of information about drag tracks, but I'm interested in creating a 2d jigsaw-type puzzle using 3d objects and I'm having trouble with draggables and Align Along Plane.

I'm inspired by the arranging puzzle demos from the examples. My hope is to put together, for example, a ripped up photo and then be able to turn and look at the back.

Comments

  • edited June 2022

    Oh, I forgot to mention my current problem.

    My puzzle piece, which is attached to a plane in the scene, explodes off the table top and jumps around the scene when I interact with it.

    Very exciting, but not great for solving puzzles.

    The piece has a rigid body and box collider (it's a scaled cube at the moment). The plane has its collision turned off. The puzzle piece is constrained to the plane.

  • Draggables are still bound by the rules of Unity's physics system, so "exploding" objects may be caused by two objects overlapping.

    Align Along Plane constrains an object's movement (when being dragged) to the cross-product of the force and the Plane's up-vector. Essentially, if you assign a Plane, it'll move along it. You can disable the Plane's Mesh Collider and Mesh Renderer - all the Draggable needs to know is its orientation.

    The "Puzzle template: Item arranging" package doesn't rely on Draggables, however, but the Inventory system with the aid of some simple scripting. When working in 2D where precision is necessary, I'd recommend this approach as opposed to trying to get the Draggable system (which is for 3D games) to work in a 2D environment. Is it possible to adapt the puzzle template to suit your needs?

  • Yeah, I've tried using the arranging items demo, but when I try running it with a 1st person character, even if I turn off the 1st person movement, the puzzle doesn't work. The hidden puzzle pieces show up red and puzzle logic doesn't play. Any tips?

    I'm currently trying to scour YouTube tutorials to make my own 3d puzzle (I don't need the movement to be 3d, but I would like the assets to be). Fingers crossed....

  • The item-arranging package is in 2D - you'll need your game to be in 2D at the time that it is run.

    The "game-wide" setting for this is the Camera perspective field in the Settings Manager. If you turn off 1st-person movement, set this field to 2D, you should find that the scene is then interactive.

    It is possible - upon scene creation - to override this "game-wide" setting for the duration of the scene. In a fresh scene, see the Override the default camera perspective? option that appears in the Scene Manager before you organise scene objects.

    It's a bit tricky, but you can retroactively update an scene to override the camera perspective. If the above test worked, switch back to 3D, and then locate the Scene Settings component on the GameEngine object inside the item-arranging scene. In its Inspector, check Override Camera Perspective and set Camera Perspective to Two D. That should cause the game to switch to 2D for the duration of the scene - allowing you to play in 3D for the rest of it.

  • Oh interesting. It *has* to be in 2d. Ok I’ll try this, thanks!

    Ideally I’d like to find a solution that could be in 3d. The dream is to be able to put several items together, say a torn photo, and then be able to spin it around and read the now-assembled clue on the back.
  • To be clear: by 2D, I'm referring to the Collider components involved. Interactions are based on Collider raycasting, and so a 2D scene works with 2D Colliders, while 3D works with 3D Colliders.

    Regardless of which type are used, objects themselves are still in 3D space - and can be represented by models rather than sprites.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.