Obi Official Forum
Help radius of individual particles at runtime - 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 radius of individual particles at runtime (/thread-3174.html)



radius of individual particles at runtime - burspa - 10-11-2021

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?


RE: radius of individual particles at runtime - josemendez - 10-11-2021

(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/manual/6.2/scriptingparticles.html


RE: radius of individual particles at runtime - burspa - 11-11-2021

(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/manual/6.2/scriptingparticles.html

Ah thanks, I was using .Set and it didn't seem to work. But assigning a new Vector4 is working thanks!


RE: radius of individual particles at runtime - josemendez - 11-11-2021

(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#.


RE: radius of individual particles at runtime - burspa - 11-11-2021

(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