Please sign in to access this page

Physics Simulator

Physics Simulator

34 devlogs
102h 46m
Created by Luke Barkess

A 2D physics simulator made in Rust.

Timeline

Earned sticker

Did some more work on getting the demo working like clearing and loading presets.

Update attachment
Earned sticker

I was working on making a camera controller and UI for a demo release.

Update attachment
Earned sticker

Collision response seems to finally be working as I finally found my error which was literally two characters. I need to handle all collision states like polygon and points then test soft and rigid body collisions.

Earned sticker

I've been doing some testing trying to work out some bugs.

Update attachment
Earned sticker

I think collision detection is now at least some what working in a way that also responds angularly as well.

Update attachment
Earned sticker

I did some more research and work on collision detection I think I understand how to determine the collision point for polygon collision now.

Update attachment
Earned sticker

I did some more work on the collision detection and trying to figure out a good solution to keeping code clean.

Update attachment
Earned sticker

I didn't have much time today but I did some more research in angular collision response and need to edit my current impulse calculation as currently it's wrong.

Update attachment

I cleaned up some code and parts to do with collision detection however still have to work on it. I was working on resolving angular properties in collisions.

Update attachment

I added modular integrators so I can add more compilcated ones such as Runge-Kutta 4 and Verlet. I also did research on how to find the collision point and how to use it to also resolve angular properties so collisions will cause rotations too.

Update attachment

I redesigned how the world stores bodies and now have a single unified body struct which makes code much more readable and should be much more efficient than before that had like 6 hash maps.

Update attachment

I was working on optimising some parts of the engine such as moving from component storage with many hash maps to just a vector of bodies, body wont be an enum any more just a single body struct that can be built.

Update attachment

Almost finished SAT collision info generation that is used by the resolver to resolve the collision. At the moment the resolver doesn't use the collision point to affect the angular properties too.

I did some more work on SAT collision I think detection is working and just need to calculate collision info like penetration depth and normal etc.

Update attachment

I've moved back to collision and did some testing with circle-circle detection and response to check its working, I also started working on SAT collision detection.

Update attachment
Luka Trojan Luka Trojan 20 days ago

I too am making a physics engine in rust!

I just did some soft body testing mostly and a few changes to soft body code. This example has a soft body pentagon and the top point is being accelerated to the left.

I've gotten some sort of basic soft body implementation, I should return to rigid body collision I took a break from.

I've randomly decided to rework soft bodies and make them an abstraction of points and springs instead of an actual body in the engine.

Update attachment

I did some reviews and work on soft bodies and I'm going to add the front-end graphics for soft body springs.

Update attachment

I've been working on soft bodies more and how they fit in with the design, I also did some testing with mass spring systems and implemented a drag effector like air resistance.

I took a break from SAT collision and started working on soft bodies which requires me to change a decent amount in both the engine and graphical side.

Update attachment

I started learning about SAT collision detection and begun an implementation for rectangles.

Update attachment

I setup the first collision response algorithm for circles, it uses impulse and projection response methods. I tested it out with a demo that approximates pi. Next I need to add detection and response for rectangles and polygons.

I setup the collision system and used traits so custom collision pipelines can be implemented, I started on the actual collision detection and response.

I have been working on implementing collision detection and in a way so that new collision algorithms can be easily added and used in the engine.

Update attachment

More engine design and supporting rotations and changed force generators to effectors that can also change angular properties and could potentially be used for constraints in the future. It's not very optimised at the moment.

I've been working on a ECS style system which I think makes sense for the project and to ensure it's modular and extensible.

Update attachment

I started on rigid body support and how they will fit into the design as well as future extensibility such as soft bodies. I also researched more into collision detection and resolution.

I implemented an id pool for objects and force generators to support adding and removing better, next I will try to expand my current objects into rigid bodies that have shape, rotation etc.

I have redesigned the engine again which should be the last time, it is now more modular which should make it easier to extend its functionality in the future. There are now force generators which produce a force on objects and can be customised and added in the future.

I've been thinking on the implementation and design of the engine its self such as which integration method to use as I was using semi-explicit Euler but Runge-Kutte 4th might be better, I was also thinking about how to implement units so you could use anything from meters to light years if you want.

Update attachment

I've been working on some of the front-end graphical side adding support for polygon shapes using a triangulator library to convert the points into triangles that can generate a mesh. I'm also trying to add support for different units for like length and mass etc.

Update attachment

I have been working on the front-end bevy side by improving physics object spawning and started on polygon graphics.

Update attachment

I've started the project and decided on splitting it up into two separate crates one for the back-end physics engine and another for displaying the simulation using bevy. I setup a basic physics starting point and I'm now integrating it into bevy.

Update attachment