Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How many particles are defined for a given rope ?
#1
Hi, I'm looking for a formula to get the active number of particles for a given rope. (using actor.activeParticleCount).

I noticed that it only depended on the blueprint and that the formula looked like :

Resolution * Length of the rope / Thickness
but it doesn't work every time...
Reply
#2
(10-11-2021, 10:15 AM)lufydad Wrote: Hi, I'm looking for a formula to get the active number of particles for a given rope. (using actor.activeParticleCount).

I noticed that it only depended on the blueprint and that the formula looked like :

Resolution * Length of the rope / Thickness
but it doesn't work every time...

There's not a closed formula that given rope length/resolution returns the number of particles in it, as this also depends on the shape of the rope, and specifically control point placement.

The blueprint is made of catmull-rom curve segments (aka "spans"). Each curve span calculates its own number of particles as:

Code:
particlesInSpan = 1 + Mathf.FloorToInt(spanLength / thickness * resolution);

Then the distance between particles is adjusted as:

Code:
float distance = spanLength / particlesInSpan;

This ensures there's always a particle at each blueprint control point (the point where two consecutive spans meet). However it also causes particle spacing (distance between particles) to vary slightly between spans. You can see the code used in ObiRopeBlueprint.cs, lines 52-82.

let me know if you need further help Sonrisa
Reply
#3
(10-11-2021, 10:32 AM)josemendez Wrote: There's not a closed formula that given rope length/resolution returns the number of particles in it, as this also depends on the shape of the rope, and specifically control point placement.

The blueprint is made of catmull-rom curve segments (aka "spans"). Each curve span calculates its own number of particles as:

Code:
particlesInSpan = 1 + Mathf.FloorToInt(spanLength / thickness * resolution);

Then the distance between particles is adjusted as:

Code:
float distance = spanLength / particlesInSpan;

This ensures there's always a particle at each blueprint control point (the point where two consecutive spans meet). However it also causes particle spacing (distance between particles) to vary slightly between spans. You can see the code used in ObiRopeBlueprint.cs, lines 52-82.

let me know if you need further help Sonrisa

thank you it's clearer.
Reply