Build a simple 2D physics engine for JavaScript games (2012)
developer.ibm.com
developer.ibm.com
For a more lay explanation you solve constraints directly by moving elements around and using the difference between their current position and previous position as their velocity. If you've some experience of numerical integration it's quite similar to verlet integration. This approach is good because it lets you have constraints with infinite stiffness without the simulation exploding.
The original papers consider points (like a mass-spring system) but it's also been extended to rigidbodies.
[1] https://ipc-sim.github.io/ (see related projects section at bottom)
I'm new to physics engines—I just started figuring out how to upgrade my simple grid cellular automata engine to a 2D engine for my toy sim tool (https://github.com/breck7/simoji) —and have been surprised by existing implementations, because it just seems not how the universe actually computes. I had not seen PBD before and it seems to be a closer model.
https://developer.nvidia.com/gpugems/gpugems3/part-v-physics...
Basically in PGA2D, rotations, angular velocity/acceleration, torque etc automatically get handled by geometric product of multivectors. The additional dimension makes all rotations centered at origin, which makes them compose much more nicely.
I didn’t even notice at first. I just thought “oh that’s cool: they’ve primed the physics so it bounces through neat patterns before settling”. But my brain was gently tapping my shoulder... When I listened to it I noticed it was a hypercube, saw “n-dimensional“, and WOW
So you think would PGA aid in understanding the weird properties of SO(3) and SE(3) (and its tangent spaces), as well as writing simulation code with it? I know that people use various representations for rigid transformations (screws vs. dual quaternions vs. exponential maps vs. motors), but I am interested which method would work the best in both a theoretical sense (in understanding the kinematics and dynamics more abstractly) and in a pragmatic sense (difficulty of writing and reading actual simulation code, amount of operations used, SIMD-friendliness, etc.)
You might find Professor Lasenby's 2020 talk (among others at Bivector Youtube channel) useful: https://www.youtube.com/watch?v=m7v2IUJtC3g
[1]: https://eloquentjavascript.net/16_game.html
[2]: https://eloquentjavascript.net/code/#16
Are they trying to mimic Digital Ocean's docs to promote their brand?
Exactly my thought. Totally unexpected.
Not only is this an old post published just after DO lunched - but it apparently was updated before it was published…
Anyone who was new to JS in the last five years is going to see the older syntax in this post and be like “what ‘prototype’? Why aren’t they using ‘let’ and ‘const’? Why aren’t they using forEach to loop through that array? Why isn’t this in TypeScript?”…
https://leanylabs.com/blog/js-forEach-map-reduce-vs-for-for_...
has nightmare
You can implement a WASM runtime _in_ JavaScript (and people have done this, and it turned out to run so well that in some cases the performance hit was basically irrelevant), but that's because JS is Turing complete and any Turing complete system can emulate any other Turing complete system.