Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Cloth does not follow animation
#4
(02-08-2018, 02:35 PM)adev eloper Wrote: Hi Josemendez,
I should mention that I am working on a realistic simulation, not a game. It is a research project, and I could end up implementing something if there is no suitable tool for this.

Since my post, I have been able to update the mesh collider based on the animation pose (https://answers.unity.com/questions/1197...inned.html), and I am now looking into updating the Obi mesh collider with this updated info. Somehow, the obi collider stops working when I update programatically, e.g. below:

Code:
...
myUpdatedCollider.sharedMesh = newMesh;
obiCollider.SourceCollider = myUpdatedCollider;

How can I force a pose to be used as input for the obi collider?

Just for the record, imho this all seems like a terrible idea. Modifying the collider mesh will force Unity (and Obi) to re-generate the internal hierarchical representation of the mesh geometry (in Obi's case, a multi-level hash grid), which can become much more expensive that the cloth simulation itself depending on how often you do it. You will also run into a lot of tunneling issues with collision detection (as MeshColliders aren't convex in the general case, thus being treated as paper-thin instead of solid volumes).

This being said, you might be able to modify Obi slightly to support modifying the collision mesh at runtime:

- Go to ObiColliderBase.cs and change the "tracker" declaration from protected to public (line 65).
- Get your ObiCollider component, and call this:
Code:
((ObiMeshShapeTracker)collider.tracker).UpdateMeshData();

I cannot guarantee 100% that this will work, as it was designed to update the mesh once at startup. There's a pretty good chance that it will, though.

My advice regarding this would be to use signed distance fields. You can precompute pretty much all of the collision information (distance, gradient), they can be blended together via relatively simple operations (useful in flexible regions such as elbows and knees in case you need realtime animation) and can be regarded as solid volumes even for concave shapes, so that tunneling becomes less of an issue.
Reply


Messages In This Thread
Cloth does not follow animation - by adev eloper - 01-08-2018, 04:29 PM
RE: Cloth does not follow animation - by josemendez - 02-08-2018, 04:11 PM
RE: Cloth does not follow animation - by shilltk - 30-09-2022, 03:52 PM
RE: Cloth does not follow animation - by Ocean - 14-10-2022, 07:38 AM
RE: Cloth does not follow animation - by Ocean - 17-10-2022, 02:36 AM