24-01-2023, 12:54 PM
(This post was last modified: 24-01-2023, 01:08 PM by ilyas_Gefeasoft.)
(20-01-2023, 12:48 PM)josemendez Wrote: Rigidbodies and softbodies have very little in common, and what you are trying to do is *a lot*more complex to do in the case of a softbody than it is for a rigidbody.Hello Again,
A rigidbody -as the name implies- is "rigid". This means its mesh cannot deform at all due to collisions or external forces. As a consequence of this, its center of mass is fixed in its local frame of reference. As the rigidbody moves, you can basically transform all vertices in the mesh by the object's transform and you're done. MeshColliders take advantage of the fact that the mesh doesn't deform to implement collision detection efficiently:mesh data is preprocessed and stored in a spatial partitioning data structure (BVH, BIH, Kd-tree, etc), that stays the same throughout the lifetime of the rigidbody.
Removing a triangle from a rigidbody is as simple as taking out the triangle from the mesh, and telling its MeshCollider to update its internal data structure.
A softbody however, is "soft". Its mesh will deform, so you cannot easily define a single frame of reference for it, and you cannot use MeshColiders since that would require to update its internal stricture every frame which is terribly slow. So for physical simulation, multiple particles (each with their own position, mass, inertia tensor, etc) are used, and their positions re-used for collision detection, instead of using the mesh directly. Each individual vertex in the mesh is independently transformed (just like in an animated character) so SkinnedMeshRenderer must be used instead of a MeshRenderer.
Removing a triangle from a softbody requires taking it out from the mesh, updating its particle-based physical representation (the blueprint, in Obi's case) and also update the skinning information in the SkinnedMeshRenderer, used to transform the mesh's vertices as the softbody deforms.
I'd recommend reading up on particle position-based dynamics and linear blend skinning. There's a lot of new concepts you must understand before attempting to do what you want.
kind regards,
Thank you, with the information I got from you, I was able to successfully implement the removing triangle on obi softbody . Now I would like to ask another question if it is ok with you.
I want to separate the object in two after I removed all the triangles from middle or while i am removing the triangles it gets separated from the part of removed triangles. Do i need to access particles or what?
P.S; I did not fix the culling that is why the other side of mesh seems empty. I also added the image for the cloth that I am trying now.
Best regards,