Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  thinning by contact
#1
Pregunta 
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?
Reply
#2
(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/manua...icles.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/manua...sions.html
Reply
#3
(26-11-2021, 09:33 AM)josemendez Wrote: Hi!

Just reduce particle radius (solver.principalRadii). This can easily be done using the particle API:
http://obi.virtualmethodstudio.com/manua...icles.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/manua...sions.html

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?
Reply
#4
(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/manua...icles.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!
Reply