Best Way to Detect 2D Collision

Title, but for many Gui objects. I have reworked my collision system multiple times and I am starting to confuse myself. A player should be able to move around on the screen and collide with objects it encounters. The objects are moved around on the screen as the player moves as well. Any ideas?

1 Like

If I were you I would start by only doing collision detection between Axis Aligned Bounding Boxes (AABBs) because it’s super simple. Writing a physics engine is still plenty challenging.

Honestly, the easiest thing might be having 3D parts and stuff do the physics, and then just move the GUI elements to fit the positions and rotations of the 3D parts. You can lock the parts to only rotate on e.g. the Z axis.

1 Like

Yo dude, ive writen a piece of code that will allow you to detect collisions. If you want to use it, here is the link to the model:

Put CollisionHolder inside of the StarterGUI folder. And put for the object that you want to detect the collision for a CollisionDetection module inside of it.

Enable IsStatic if you want to make sure that moving objects can’t enter that object