Dig mechanics - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html) +--- Thread: Dig mechanics (/thread-3302.html) |
Dig mechanics - PlatonSk - 02-02-2022 Hi there. Thanks for a great asset. I gonna add some digging mechanics to a softbody. Got a number of questions. So basically we have a softbody that acts as a regular soft body. But by clicking a button we'll start "dig". Dig mechanics should be split into a number of actions: 1. Disable mesh deformation while keeping collision detection intact. Can this be done using some basic OBI methods? 2. Determination which verticles of the mesh are bind to our affected particles. For each particle world coordinates I can run through all verticles and compare distance, but maybe there's a better way? Is there some sort of a dictionary containing all binded verts for each particle? 3. New mesh generation. Okay, we found our vertices, removed them, added a bunch of new verticles and triangles to form an updated shape. Is it possible to use a newly updated mesh with an existing blueprint before we generate a new one? 4. New blueprint generation When the dig sequence ends we will recalculate a blueprint and bind it to a new body - no questions here, works just fine! Thanks in advance! RE: Dig mechanics - josemendez - 02-02-2022 (02-02-2022, 12:50 PM)PlatonSk Wrote: So basically we have a softbody that acts as a regular soft body. But by clicking a button we'll start "dig". Dig mechanics should be split into a number of actions: Hi there! Setting the inverse mass of a particle to zero (essentially giving it infinite mass) will deactivate any dynamics, but rigidbodies will still be able to collide against it. Particles will not move as result of collision detection tough (since no dynamics can affect them), rigidbodies will regard them as kinematic. See: http://obi.virtualmethodstudio.com/manual/6.3/scriptingparticles.html (02-02-2022, 12:50 PM)PlatonSk Wrote: 2. Determination which verticles of the mesh are bind to our affected particles. Yes, this is provided by Unity's skinned mesh renderer. You can retrieve a list of bones for each vertex, these bone indices correspond to softbody particle indices. (02-02-2022, 12:50 PM)PlatonSk Wrote: 3. New mesh generation. Depends on what you mean by "use an updated mesh with an existing blueprint". If you mean that in a literal sense, no. You need to generate a blueprint using the new mesh for new particle/constraint data to be generated. That's what "generating" a blueprint does. If you mean skinning the new mesh to an existing blueprint, yes. You can assign the mesh to a ObiSoftbodySkinner and call its BindSkin() coroutine to bind it to the softbody. let me know if I can be of further help! |