NokiMo
relativisticgame
relativisticgame

patreon


Week 41: improving collisions

This week I mostly worked on improving the implementation of collisions in the game. Unfortunately, this is a challenging area of my project. I consider it one of the biggest technical challenges (in terms of difficulty rather than amount of work to do.) I wrote down some notes on paper. I will document some of the key findings into a proper article soon.

While implementing collisions, I found a behaviour that looked wrong: the robot was bouncing up and down from the upper wall to the bottom wall of the room, but only when it had its legs pointing up (see video). Initially, I thought this was a bug in my rigid body implementation. I added more tests to the code to check its correctness. In the end, new and old tests confirm once more that my implementation is correct. The problem lies on how rigidity affects the dynamics. That’s subtle and difficult to explain in a few lines of text. Basically, the body has more inertia when moving along directions where it is longer, e.g. the diagonal for a square mesh. This property is connected to the known fact that a Born-rigid body has a maximum acceleration that is inversely proportional to its extent.

Anyway, the problem is fixable. For example, the mesh can be made a bit more round to reduce the anisotropy. Well, raising the friction a bit is enough to remove the bouncing. However, I am not yet satisfied with how the robot’s navigation feels. It is difficult to prevent the robot from going through walls, especially when speeding up too much. For this reason, I spent a day or so working out how to limit the robot’s velocity. The idea is to change the collision dynamics to remove any components of the acceleration that would make the velocity of the player, relative to a reference object (e.g. the room), exceed a certain magnitude. While working out the formulas I also extended the article https://relativisticgame.net/articles/hyperbolic-3d.html , in particular the section “Alternative velocity formula”. This was only theoretical work. I still need to code it.

A final thing to mention is that I continued the article I started writing last week. It is now published on my site: https://relativisticgame.net/articles/game-physics.html.


Related Creators