How can I make 2D collision?

robloxapp-20200602-2344441.wmv (153.8 KB)

In the video above it shows me moving a piece of the GUI or the character. I want to make it a border so that way I can’t go inside it but be able to go around it. I’ve looked at various posts but they don’t make sense to me.

2 Likes

2D collision is not a super easy thing to do. Your best bet (if you want to make it from scratch) is to look on youtube for general, non Roblox tutorials. However, you can use Roblox’s physics for this. You can create hitboxes for different images with parts, then you can map the position of the objects in the workspace to objects on your 2D screen (e.g. 1 stud = 1 pixel, and you could center the screen). Then you just need to lock one position axis and disable rotational movement.

For the last bit, you can use Heartbeat which fires immediately before physics. On Heartbeat if you set the RotVelocity to an empty vector, then for the Position you can create a new CFrame with the X and Y coordinates saved but the Z coordinate locked to some value. That all can allow you to have 2D physics that rely on Roblox physics.

1 Like

I think for now I’ll look around on youtube and other sources although the 2D physics does sound interesting.

Hope this video help you

4 Likes