Page 2 of 4

Re: [Tutorials] Making a simple 2D physics engine

Posted: Thu Oct 16, 2014 2:18 pm
by HugoBDesigner
Tjakka5 wrote:EDIT: Nevermind, got it fixed

Great code, works like a charm. Really want to make a game with this now :3
Thank you! Glad I could help ^^

Re: [Tutorials] Making a simple 2D physics engine

Posted: Sat Oct 25, 2014 3:43 am
by HugoBDesigner
So, guys, sorry that it took so long for me to release the part 2 of this tutorial. I got a new computer, and there was a lot of things I had to organize before working on the part 2. But now it is done and published, if you guys want to check out:

Making a Simple 2D Physics Engine - Part 2

Also, thank you guys so much for your feedback on my last tutorial, you guys are awesome, and I'm really glad that you guys understood and liked it!

Re: [Tutorials] Making a simple 2D physics engine

Posted: Sat Oct 25, 2014 3:54 am
by Zilarrezko
You know, just an hour ago I was about to post saying "Soo.. part 2 man?".

Bravo!

Re: [Tutorials] Making a simple 2D physics engine

Posted: Sat Oct 25, 2014 5:34 am
by HugoBDesigner
Heheheh... Yeah, that took a while, but at least it won't happen in part 3 (unless I get another new computer :P )

Re: [Tutorials] Making a simple 2D physics engine

Posted: Sat Oct 25, 2014 7:54 am
by Zilarrezko
you're fine man, take your time.

Re: [Tutorials] Making a simple 2D physics engine

Posted: Sat Oct 25, 2014 9:37 am
by Rucikir
I was reading your tutorial, and I was wondering: checking collisions by detecting if the corners of one object are in the body of another won't work if the speed of the first object is greater than the height/width of the second, right ? How should it be managed ?

Re: [Tutorials] Making a simple 2D physics engine

Posted: Sat Oct 25, 2014 9:46 am
by HugoBDesigner
Rucikir wrote:I was reading your tutorial, and I was wondering: checking collisions by detecting if the corners of one object are in the body of another won't work if the speed of the first object is greater than the height/width of the second, right ? How should it be managed ?
Either with the intersection rectangle method or with the corner-checking methods this shouldn't be a problem: your object will be bumped as soon as it contacts the other object, and even if the object's speed is greater than the other object's size, you'll only add up to the object's position in fractions, and not directly the "size" of your speed. Simplifying: the object shouldn't pass straight through/be ignored by the second object unless the object is TOO MUCH fast and the other object is TOO MUCH thin, which would also have problems in the intersection rectangle method. And, even in this case, you can still set up a maximum speed to your object, so you don't run this risk :)

Although, if you tested it and it didn't work, feel free to post your code (or part of it) here, so I can help you in more details :awesome:

Re: [Tutorials] Making a simple 2D physics engine

Posted: Sat Oct 25, 2014 9:46 am
by Zilarrezko
Rucikir wrote:I was reading your tutorial, and I was wondering: checking collisions by detecting if the corners of one object are in the body of another won't work if the speed of the first object is greater than the height/width of the second, right ? How should it be managed ?
He and/or she has a point (get it? HA!). But that would be a very fast block / very small blocks.

But yes in those cases that would be a problem. Though at ~60 fps, I think it would be fine. At 10, that's when that very fast/small block would start become a problem. But of course it's all relative to the situation.

Edit: well geez, looks like Hugo too fast for this ol' block, I missed that collision detection by a few frames. (My god, the references...)

Re: [Tutorials] Making a simple 2D physics engine

Posted: Sun Oct 26, 2014 9:57 pm
by lippo
thanks for you tutorial

Re: [Tutorials] Making a simple 2D physics engine

Posted: Mon Oct 27, 2014 1:21 am
by HugoBDesigner
lippo wrote:thanks for you tutorial
You're welcome :ultrahappy:
If you need any help, have any suggestion or criticism, feel free to let me know :3