24-01-2023, 08:35 AM
(This post was last modified: 24-01-2023, 08:38 AM by josemendez.)
(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.
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