CS560, Fall 2019
December 12th
For this project, I choose cloth model for implementation, for the solution method, I choose Runge-Kutta-4 and for the contact force method, I choose Impulse based force.
Classes:
In order to implement cloth animation properly, I write three classes. The first class is the ball rigid body which contains properties of rigid body and ball collider. This object is the main part of the simulation, playing as both cloth particles and collider balls in the scene. The second class is the spring class, which contains indices of two ball rigid bodies of its two sides, a rest length value and a coefficient value K. The third class is the updater class which loops over all the rigid bodies and springs, adding forces and doing RK4 updating each frame.
Setting Up Cloth:
To build a cloth, I made a 49 by 49 grid structure together with static mesh, for each points in the grid, I placed a ball rigid body and connect each ball to its 8 neighbors with a spring object.
Updating:
During each frame, the updater loops over all rigid bodies, doing collision checks and applying colliding forces for each ball. In order to prevent cloth from weird results, I disabled collisions between cloth particles by giving them same collider channel. Then the updater loops over all the springs and apply spring forces to balls of its two sides using Hooke’s law. After that I loops over all the balls again and apply gravity to them (I choose 10 as the gravity acceleration). Lastly, I do the RK4 solving to update all the rigid bodies. To keep the robustness of the simulation, I clamp the delta time to make it less than 0.02 seconds.
Describe of Video:
The video shows physics simulation of one cloth and two rigid balls in the scene. The four angles of the cloth and two balls are set to kinematic at first.