[Tutorials] Making a simple 2D physics engine

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Above the Pocket Dimension
Contact:

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

Post 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 ^^
@HugoBDesigner - Twitter
HugoBDesigner - Blog
User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Above the Pocket Dimension
Contact:

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

Post 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!
@HugoBDesigner - Twitter
HugoBDesigner - Blog
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

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

Post by Zilarrezko »

You know, just an hour ago I was about to post saying "Soo.. part 2 man?".

Bravo!
User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Above the Pocket Dimension
Contact:

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

Post 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 )
@HugoBDesigner - Twitter
HugoBDesigner - Blog
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

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

Post by Zilarrezko »

you're fine man, take your time.
User avatar
Rucikir
Party member
Posts: 129
Joined: Tue Nov 05, 2013 6:33 pm

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

Post 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 ?
User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Above the Pocket Dimension
Contact:

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

Post 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:
@HugoBDesigner - Twitter
HugoBDesigner - Blog
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

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

Post 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...)
lippo
Prole
Posts: 8
Joined: Sat Oct 18, 2014 2:40 pm

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

Post by lippo »

thanks for you tutorial
User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Above the Pocket Dimension
Contact:

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

Post 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
@HugoBDesigner - Twitter
HugoBDesigner - Blog
Post Reply

Who is online

Users browsing this forum: No registered users and 44 guests