Step 3: Introducing collision correction
As stated in the previous post, the velocity of the spheres were not conserved using Unity's Rigidbody system. According to Micky Kelager's paper Lagrangian Fluid Dynamics Using Smoothed Particle Hydrodynamics (2006), the kinetic energy and hence the velocity had to be redirected after colliding with different objects. Hence we introduced Kelager's proposed collision system in the Unity's OnCollisionEnter and OnCollisionExit functions. In the video below (obs! video updated for clearer view) it can clearly be seen how the spheres start moving in a more wave-like pattern. This video, compared to the one in the last blog post, shows a greater and more water-like movement in the spheres.
Even though the pattern seems wave-like, compared to the last blog post, it is nowhere near a adequate water simulation. Due to the limitations using Unity's Rigidbody - the impossibility do directly calculate acceleration and velocity and use those values when managing the collision, we are pondering over if we should implement Kelager's algorithm from start to finish, including collision detection and not only collision managing. This would also include a LeapFrog-algorithm to estimate the next position and next velocity for each particle, taking into account the collision between each separate water particle and the container.
Even though the pattern seems wave-like, compared to the last blog post, it is nowhere near a adequate water simulation. Due to the limitations using Unity's Rigidbody - the impossibility do directly calculate acceleration and velocity and use those values when managing the collision, we are pondering over if we should implement Kelager's algorithm from start to finish, including collision detection and not only collision managing. This would also include a LeapFrog-algorithm to estimate the next position and next velocity for each particle, taking into account the collision between each separate water particle and the container.
Kommentarer
Skicka en kommentar