Creating a physics engine

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
hihgsped
Prole
Posts: 1
Joined: Tue Jul 09, 2019 7:01 pm

Creating a physics engine

Post by hihgsped »

Hello,

I'm in the process of creating my own 2d physics engine, but I'm hung up on resolving collisions between objects in my game. Does anyone have any tutorials that explain this process that I could have a link to? I've done a bit of searching but I can't seem to find the right material.

Thanks,
hihgsped
sphyrth
Party member
Posts: 260
Joined: Mon Jul 07, 2014 11:04 am
Contact:

Re: Creating a physics engine

Post by sphyrth »

Studying Love2D's Physics Library might help you. especially love.graphics.newFixture, and love.graphics.getDistance.
User avatar
pgimeno
Party member
Posts: 3656
Joined: Sun Oct 18, 2015 2:58 pm

Re: Creating a physics engine

Post by pgimeno »

Depends on whether your shapes are arbitrary or AABB. If you need arbitrary shapes for your objects, collision resolution is going to be a very hard problem, and I recommend sticking to Box2D; however, you can try the HC collision detection library, but last time I checked, it didn't provide collision response, only detection.

For AABBs, things become simple enough for a DIY. I can't recommend any specific tutorial, but look for sources that use 'Minkowski difference' as that simplifies collision resolution a lot.
PGUp
Party member
Posts: 105
Joined: Fri Apr 21, 2017 9:17 am

Re: Creating a physics engine

Post by PGUp »

love2d already has it's own physics library, love.physics, if you are struggling with collision detection look this up
https://2dengine.com/?p=intersections
-
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Creating a physics engine

Post by raidho36 »

You probably won't be able to do any better than Box2D is already doing, in terms of performance anyway. So if you feel like doing a trigonometry exercise then go ahead, but otherwise you should just learn to use an existing physics engine instead.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 3 guests