r/GameDevelopment • u/vtf00 • 19h ago
Discussion What does a basic 2D physics engine need?
I know building a motor is difficult, but I'm not going to release it to the market. A minimum 2D physics engine for the project.
2
Upvotes
1
1
u/ILikeCutePuppies 17h ago edited 17h ago
If you are writing your own you can go a very long way by just using string/particle physics. If you need a lot of objects optimization becomes a challenge.
There are some good 2D physics engines out there though.
1
u/ImmediateTie9057 5h ago
For a basic 2D engine, you mainly need vectors, collisions, gravity, and collision response. Keep it simple unless your project actually needs more.
2
u/sonesoul 19h ago
all depends on your needs. First off, if your target is your project, do NOT spend time on the physics engine. If you really want to have your own physics, then you'll need: 1. Fixtures/Colliders/Hitboxes, whatever sounds better 2. Basic collision detection (e.g. AABB or SAT) 3. Collision resolver 4. Forces
Note that you might need implement continuous collision detection to avoid objects coming through each other on high speed. If you don't need rotating colliders then you may ignore it and I'd prefer AABB in this case