Inspiration

I want to make some tower defense games or homemaking games and I needed a way to not only place items but also snap to grid placement. This was a good opportunity to build a core mechanic. I think this is the type of mechanic that works in many situations and would be handy for other people to have!

What it does

It allows players to easily drag and drop items on a grid via screen interaction on mobile devices and desktop.

How we built it

It uses custom input to swap a player into focused interaction and a local camera position above the map. It uses raycasting to identify selectable objects and another raycast to determine where the selected item is placed. Custom UI is used to spawn assets compatible with the drap and drop interaction.

Challenges we ran into

It's important that the objects not be static and they have corresponding tags to the raycast object tag for proper interaction.

Accomplishments that we're proud of

I'm very happy with how easy the mechanic is to test and how quickly drag and drop could be implemented into a world

What we learned

It was fun to think about how this could be scaled into a larger system.

What's next for Drag and Drop Raycasting

I'd like to build a tower defence game using this interaction.

Built With

Share this project:

Updates