Help thinning by contact - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html) +--- Thread: Help thinning by contact (/thread-3204.html) |
thinning by contact - greyhawk - 26-11-2021 How do I thin a selected region of the rope? What I want to do is to thin the points between the object contact and the points I have determined. What is your suggestion? RE: thinning by contact - josemendez - 26-11-2021 (26-11-2021, 08:50 AM)greyhawk Wrote: How do I thin a selected region of the rope? What I want to do is to thin the points between the object contact and the points I have determined. What is your suggestion? Hi! Just reduce particle radius (solver.principalRadii). This can easily be done using the particle API: http://obi.virtualmethodstudio.com/manual/6.3/scriptingparticles.html For detecting collisions, you can use collision callbacks. Each contact provides body and simplex indices, from which you can determine the particle(s) you need to change the radii of: http://obi.virtualmethodstudio.com/manual/6.3/scriptingcollisions.html RE: thinning by contact - greyhawk - 26-11-2021 (26-11-2021, 09:33 AM)josemendez Wrote: Hi! How do I reduce the radius of 3 particles(middle particle detecting by collision) I specified using "solver.principalRadii"? can you show an example? Because only the get operation is performed in the method you linked. Do you think I should modify the asset code? Or am I thinking wrong? RE: thinning by contact - josemendez - 26-11-2021 (26-11-2021, 12:02 PM)greyhawk Wrote: How do I reduce the radius of 3 particles(middle particle detecting by collision) I specified using "solver.principalRadii"? can you show an example? Because only the get operation is performed in the method you linked. Do you think I should modify the asset code? Or am I thinking wrong? There's no need to modify the asset's code at all, the API exposed by it is designed to allow you to do both basic stuff such as this as well as many more advanced use cases. Solvers expose many arrays (listed in the link above), each array holds the value of a property for all particles in the solver. The principalRadii array holds (as the name implies) the principal radii of each particle. This is a vector with the radius for each axis: x,y,z. So to set the radius you just do: Code: solver.principalRadii[index] = new Vector4(radiusX, radiusY, radiusZ, 0); "solver" here is a reference to a solver, that is: a variable of type ObiSolver. radiusX, radiusY and radiusZ are the radius of the particle, in case of ropes the radius in all axis should be the same. This is all explained in detail in the link I posted in my last response: http://obi.virtualmethodstudio.com/manual/6.3/scriptingparticles.html Of course all this assumes you're comfortable with C# scripting, which is required to use Obi anyway. Let me know if you need further help! |