First, intall latest taichi by
pip install taichi
Then, run with
python tiRigidBody.py
Rember to press SPACE to start the simulation
- Press SPACE to start or pause
- "wasd" for moving the camera
- When paused, press "p" to procceed only one step(useful for debugging)
- Try to change the parameters in "init_particles()" (like init_pos, cube size etc.) or the num_particles
- Try to give another angle to the "rotation()"
- Try to change the stiffness of penalty force in "collision_response()"
The different branches record the progress of coding. Start with the simplest case, and gradually add features
- minimal_ggui: show two static particles in the screen
- init_particles: neatly stacked particles to form a box
- translation: move the box
- rotation: rotate the box
- collision_one_particle: colliding with a ramp, the collided particles are dyed to red
- bounce: the box can drop and rebounce, but no rotation
- master: the main branch
- Add more boundary walls (now there is only a ground)
- Try to give better collision_reponse (more complex penalty forces or better)
- Try to add collision detection for collision with complex geometries
- Try to add more rigid bodies, and make them collide with each other
see:
- Matthias Müller, Bruno Heidelberger, Matthias Teschner, and Markus Gross. 2005. Meshless deformations based on shape matching. ACM Trans. Graph. 24, 3 (July 2005), 471–478. https://doi.org/10.1145/1073204.1073216
- GAMES103 Course, by Huamin Wang. https://games-cn.org/games103/
近期我会录个视频到B站从头讲解原理和实现方法。图文版也会放到博客里。