Ask HN: Stacking forces in a physics engine C++

https://news.ycombinator.com/item?id=33404263
by leakbang • 4 years ago
3 4 4 years ago

So for a game that I'm working on I have looked at a lot of the widely used and widely praised physics engines (Havoc, Bullet, PhysX, Jolt, Newton Dynamics, ...) to implement in my game but after reviewing each one of them I came to the conclusion that it is best if I create my own physics resolver.

The aforementioned physics engines failed basic physics tests or had very complex code bases to the point that I think this route will be easier. I did notice that many of these engines especially PhysX and Bullet do a lot of tricks to correct their simulations. I assume one reason that they include such tricks is to optimize for performance on a wide range of hardware.

So I think it couldn't be that hard to write a simple (rigidbody) physics resolver that is only designed to run in a single thread on X86 based processors. And also I don't think I need to mess around with too many optimizations since the levels in my game are pretty small, so I might just be able to get away with it. I never dabbled too much into the nuts and bolts of a physics engine so I am quite unsure about certain things could be done.

For instance let's assume a simple case. I have a digital scale and I want to measure the weight of whatever's on top of it. So the way I would like to do it is to simply measure the amount of force that is being applied to the surface of the scale and display that. That way, when 2 objects are stacked on top of each other, it shows the correct stacked weight. Or if there is another object like a press, pushing towards the surface of the scale, then it also would show the force that the press is applying.

I don't know how to implement a system like this. Do you know of a cool way of achieving a system like this? Also if you have any tips or cool resources for physics simulations, I'd appreciate them!

Related Stories

Loading related stories...

Source preview

news.ycombinator.com