Creating a physics engine from scratch (Battlebeyz: Part 3)
WIP! Last updated Oct 26 2025 while I am still updating my site
I realized after a while that updating physics sequentially in my physicsWorld::update method could cause some unintended effects if one update affected the state of another. So, I had to figure out the best way to accumulate these changes until the end of the update scope. After some deliberation I settled on a pair vec3, vec3 return type that would group linear vs angular neatly, and a custom struct to handle these additions cleanly.
But it was only after I had gotten most way through that I realized I could just store the accumulated changes in the Beyblade class! They are obviously tied to each Beyblade instance, and functions could easily be made and called within the scope of any place where beyblade physics is calculated.
Amidst all the work, I distinctly remember a time where I was rearranging all the functions of my class. Ooh, these are simple getters, these are specialized getters, these are accumulators, these are collision-related calculators…you get the idea. Amidst all the chaos of implementing custom physics, it was surprisingly relaxing to be able to organize all you hard work into neat little adstractable categories.