Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Examples for Mesh updating and Particles
#1
Exclamación 
Hello, 

I have been searching about how to fix the mesh collider problem in my soft body project using Obi, and I faced with this question (Obi SoftBody with unity Mesh Collider and Mesh Filter (virtualmethodstudio.com)), which is somehow similar to mine. Exclamación  I wanted to ask that is there any example, where I can learn and easily understand how I can get mesh and update its particles which will give me the result as mesh collider.  My main purpose in this post is to understand how I can use the Mesh in the blueprint by code. Sonrisa

Best regards,
Reply
#2
(23-01-2023, 09:12 PM)NewCoder Wrote: how I can get mesh and update its particles which will give me the result as mesh collider

Hi!

"Getting the mesh and updating its particles" are two entirely unrelated things, and neither will give you a MeshCollider as result.

The mesh deformed by a softbody at runtime is just a skinned mesh, so you can get it by using skinnedMeshRenderer.BakeMesh() like you normally would in Unity. You could then use this mesh as input for a MeshCollider component, if that's what you are looking for.

Not sure what you mean by "updating its particles". Particles are not part of the mesh, they're part of either a blueprint or a solver. The ones in the solver are updated every frame by the ObiSolver component to follow a physical simulation. Unless you want to add/remove particles or somehow drive their movement, size, mass or some other attribute in a custom way (which you do by using the particles API) there's no need to manually update them.

(23-01-2023, 09:12 PM)NewCoder Wrote: My main purpose in this post is to understand how I can use the Mesh in the blueprint by code. Sonrisa

Getting the blueprint's mesh from code is pretty simple:
Code:
var mesh = blueprint.inputMesh;

let me know if you need further help,

kind regards
Reply