JacksonHoggard / voodoo2d

👹 2D Java Game Engine built in OpenGL
MIT License
131 stars 50 forks source link

Improve Collision System #5

Closed JacksonHoggard closed 4 years ago

JacksonHoggard commented 4 years ago

Update the collision system to make it similar to this tutorial: Here

No need to add physics engine stuff just yet, just make sure the engine has all the components necessary to develop one.

tinovasq commented 4 years ago

Howdy! I saw your help wanted poster in the window, and I'd like to see if I can lend a hand in some way.

JacksonHoggard commented 4 years ago

Go right ahead! Right now the AABB is currently partially written, and there's a lot missing. This website has a great tutorial on what should be in the AABB class. I wouldn't follow the whole tutorial, just up to where it says "Moving Object". The code they have is written in C++ but it shouldn't be too difficult to implement in Java.

tinovasq commented 4 years ago

Wonderful! I just have one question off the bat. Is there any stylistic need/ease of use reason to not use the tutorial's shown strategy of the center & distance from center variables to track the shape of the AABB? Or rather, how come you're using 3 vectors rather than just two? min = new Vector2f(); max = new Vector2f(); position = new Vector2f(); vs center = new Vector2f(); distance = new Vector2f(); where center is the coordinate of the center and distance is a sort of 'radius' from the center point of the BB in the X and Y directions.

(I'm just new to graphical interactions, asking purely for clarity)

tinovasq commented 4 years ago

Addendum here: I've rewritten the AABB class to use only the 2 vectors, looks like it should work totally fine (current system uses points for bottom left and top right, as well as position, proposed change uses point for the center, as well as height and width from the center). If that is cool with you, then I can open up a PR unless there are other classes that would interact with this that you want written or edited.

JacksonHoggard commented 4 years ago

Sounds good. The changes you made are much better than what was originally there before. I'll probably open a new issue soon with some physics tasks if you're up for it. You can go ahead and make the pull request whenever you're ready!

tinovasq commented 4 years ago

Done and done! I'm all for more physics!