Forum rules - please read before posting.

Draggable lock to cursor

Hi there

I am trying to do a drag & drop puzzle in a (1st person-unlocked cursor) 3D environment where I am dragging and dropping photographs into empty spots. The photos are draggables aligned to plane (a tabletop).

But with the current draggable system that relies on the rigidbody physics, the cursor will hit the edge of the screen and the object will stop - rather than catching up with the cursor.

Is there a way to lock the draggable to the cursor and not rely entirely on making the object very light (so it flies around) or very heavy (moves too slowly).

I'm thinking something closer to the 2D drag and drop puzzle example where the object sticks tightly to the cursor.

Latest version of AC, Unity 2021.

Thanks

Comments

  • The only way I've thought I could do this is to just parent the object to a world-space cursor instead of using the draggable system.

  • The only way I've thought I could do this is to just parent the object to a world-space cursor instead of using the draggable system.

    Possibly. The "World Space Cursor Example" may be enough for this - combined with the Object: Set parent Action when a photo is selected.

    The meat of it will be in the processing logic, however. What you might want to do is create an Inventory item for each photo, so that clicking a photo selects its item equivalent, and then attach an Event runner component to each photo object that parents it to the cursor when that item is selected.

    If the "Item arranging puzzle" template gives the behaviour you're looking for, though, that may be the best option.

    Though it's designed with 2D games in mind, there's nothing in the code that limits it to 2D. You could replace the puzzle piece 2D colliders with 3D ones to have them work in a 3D game.

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.