Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cloth soft body Balls invisible
#8
(27-08-2020, 05:54 AM)rexcheung Wrote: Hi Josemendez,

Thanks for your prompt reply. The balls are visible now by importing your new package.
I am interested in your asset as i read this post.
http://obi.virtualmethodstudio.com/tutor...aints.html 

I am now going to get the pressure and volume of the ball being hit.
After a brief study, i found that we could only apply constraints to bias the ball outlook when t is being hit.
Is it possible to get the realtime data on the pressure & volume of the ball as well.

Much thanks for your support.
Rex

Hi there,

The volume is calculated in parallel for multiple constraints for efficiency reasons, this is done on the fly every simulation step and not stored anywhere, so it's not accessible trough any public API. You can however calculate it yourself if in need. This is the pseudocode to calculate the volume of a closed shape defined by an array of vertex positions and an array of triangle indices:

Code:
float volume = 0;
//iterate over all triangles in the shape
for (int j = 0; j < numTriangles; ++j)
{  
      int v1 = triangles[j*3];
      int v2 = triangles[j*3 + 1];
      int v3 = triangles[j*3 + 2];

      //calculate this triangle's volume contribution:
      volume += math.dot(math.cross(positions[v1].xyz, positions[v2].xyz), positions[v3].xyz) / 6.0f;
}

The pressure value used internally is just the difference between the rest volume and the current volume of the shape.
Reply


Messages In This Thread
Cloth soft body Balls invisible - by rexcheung - 25-08-2020, 05:22 AM
RE: Cloth soft body Balls invisible - by josemendez - 27-08-2020, 09:23 AM