[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: 401
Joined: Mon Feb 24, 2014 6:54 pm
Location: Somewhere in Brazil

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

Post by HugoBDesigner » Thu Oct 16, 2014 2:18 pm

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 - my Twitter
HugoBDesigner - my Blog

User avatar
HugoBDesigner
Party member
Posts: 401
Joined: Mon Feb 24, 2014 6:54 pm
Location: Somewhere in Brazil

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

Post by HugoBDesigner » Sat Oct 25, 2014 3:43 am

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 - my Twitter
HugoBDesigner - my 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 » Sat Oct 25, 2014 3:54 am

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

Bravo!

User avatar
HugoBDesigner
Party member
Posts: 401
Joined: Mon Feb 24, 2014 6:54 pm
Location: Somewhere in Brazil

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

Post by HugoBDesigner » Sat Oct 25, 2014 5:34 am

Heheheh... Yeah, that took a while, but at least it won't happen in part 3 (unless I get another new computer :P )
HugoBDesigner - my Twitter
HugoBDesigner - my 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 » Sat Oct 25, 2014 7:54 am

you're fine man, take your time.

User avatar
Rucikir
Party member
Posts: 109
Joined: Tue Nov 05, 2013 6:33 pm
Location: Paris
Contact:

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

Post by Rucikir » Sat Oct 25, 2014 9:37 am

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 ?
Lua script to distribute your LÖVE games. love-release.lua : Forum | Github
@Rucikir

User avatar
HugoBDesigner
Party member
Posts: 401
Joined: Mon Feb 24, 2014 6:54 pm
Location: Somewhere in Brazil

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

Post by HugoBDesigner » Sat Oct 25, 2014 9:46 am

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 - my Twitter
HugoBDesigner - my 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 » Sat Oct 25, 2014 9:46 am

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 » Sun Oct 26, 2014 9:57 pm

thanks for you tutorial

User avatar
HugoBDesigner
Party member
Posts: 401
Joined: Mon Feb 24, 2014 6:54 pm
Location: Somewhere in Brazil

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

Post by HugoBDesigner » Mon Oct 27, 2014 1:21 am

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 - my Twitter
HugoBDesigner - my Blog

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 7 guests