Obi Official Forum

Full Version: radius of individual particles at runtime
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

Loving the rope system!

I want to be able to grab or clamp the rope with objects. I want the clamp to squeeze the rope and make the particle thinner.

Am able to change the thickness of individual particles or scale the renderer on the nearest particle at runtime? 

Thanks!

I've seen in previous posts you've mentioned simply resize the particle radius.

But I'm finding it unclear how to go about that, so do I try update principal radii?
(10-11-2021, 10:44 PM)burspa Wrote: [ -> ]Hi

Loving the rope system!

I want to be able to grab or clamp the rope with objects. I want the clamp to squeeze the rope and make the particle thinner.

Am able to change the thickness of individual particles or scale the renderer on the nearest particle at runtime? 

Thanks!

I've seen in previous posts you've mentioned simply resize the particle radius.

But I'm finding it unclear how to go about that, so do I try update principal radii?

Hi there!

You just write a new value into the solver.principalRadii array, at the index of the desired particle. See:
http://obi.virtualmethodstudio.com/manua...icles.html
(10-11-2021, 11:55 PM)josemendez Wrote: [ -> ]Hi there!

You just write a new value into the solver.principalRadii array, at the index of the desired particle. See:
http://obi.virtualmethodstudio.com/manua...icles.html

Ah thanks, I was using .Set and it didn't seem to work. But assigning a new Vector4 is working thanks!
(11-11-2021, 12:11 AM)burspa Wrote: [ -> ]Ah thanks, I was using .Set and it didn't seem to work. But assigning a new Vector4 is working thanks!

That’s because vectors are structs (value types) so you cannot do this:

solver.principalRadii[index].Set(x,y,z,w);

As that would modify a temporary value. Same applies to any array of structs in C#.
(11-11-2021, 12:26 AM)josemendez Wrote: [ -> ]That’s because vectors are structs (value types) so you cannot do this:

solver.principalRadii[index].Set(x,y,z,w);

As that would modify a temporary value. Same applies to any array of structs in C#.
Thanks, good to know