1

Collision Detection in Python OpenGl

I'm working on breakout game by using python opengl and I want to make collision detection between the ball and the bricks (Without using pygame).

I tried a lot but I couldn't and I didn't find any tutorials about it (using Python OpenGl).

How can I add collision detection in it?

My code until now:

deleted the code because the problem is solved and the whole project is changed (the code wasn't good)

Tarek Alabd
  • 419
  • 4
  • 13
  • How is this not a dupe of [the last one](https://stackoverflow.com/q/62253612)? – genpfault Jun 08 '20 at 03:54
  • I edited the last one (to add the code) after it's been closed, so I decide to delete it and ask a new question. – Tarek Alabd Jun 08 '20 at 04:01
  • See [Issue finding side of collision for Circle-Rectangle collision](https://stackoverflow.com/questions/61718259/issue-finding-side-of-collision-for-circle-rectangle-collision). The algorithm uses `pygame.math.Vector2`, but that can be changed with ease. – Rabbid76 Jun 08 '20 at 04:56
  • cannot be deleted. – Tarek Alabd Jun 12 '20 at 06:12
  • 1
    @Rabbid76 I wanna delete it or delete the code – Tarek Alabd Jun 12 '20 at 06:21
  • @Rabbid76 The main problem was that I wanted to make the collision according to the x and y axis but it was better to create a method that checks the collision between any two objects (rectangles) with the model parameter. – Tarek Alabd Jun 12 '20 at 06:26

1 Answers1

0

I finally solved my problem. I used a different architecture for the whole project and I could link my data structure with the new architecture. The idea was not using any library, just data structure.

Tarek Alabd
  • 419
  • 4
  • 13