Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  radius of individual particles at runtime
#1
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?
Reply
#2
(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
Reply
#3
(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!
Reply
#4
(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#.
Reply
#5
(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
Reply