Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Max Rest Length
#1
Hi Obi

I'm curious if there is a reliable way of calculating the Maximum Rest Length based off of the pooled particle count. During my testing I've been setting my cursor length to Mathf.Infinity in the OnElementsGenerated callback of the instantiated rope and then resetting it to it's previous length to determine this. Just curious if there's a better way to go about it.

Thank you, and fantastic job on the Obi Rope asset!
Reply
#2
(01-11-2020, 10:12 PM)VagabondOfHell Wrote: Hi Obi

I'm curious if there is a reliable way of calculating the Maximum Rest Length based off of the pooled particle count. During my testing I've been setting my cursor length to Mathf.Infinity in the OnElementsGenerated callback of the instantiated rope and then resetting it to it's previous length to determine this. Just curious if there's a better way to go about it.

Thank you, and fantastic job on the Obi Rope asset!

Hi there!

Pooled particles are spaced apart using

Code:
rope.ropeBlueprint.interParticleDistance

So you can take the rope's rest length, and add rope.ropeBlueprint.interParticleDistance * rope.ropeBlueprint.pooledParticles to it. That should be a pretty reliable estimation of the rest length once all pooled particles are used.

cheers!
Reply
#3
(03-11-2020, 09:42 AM)josemendez Wrote: Hi there!

Pooled particles are spaced apart using

Code:
rope.ropeBlueprint.interParticleDistance

So you can take the rope's rest length, and add rope.ropeBlueprint.interParticleDistance * rope.ropeBlueprint.pooledParticles to it. That should be a pretty reliable estimation of the rest length once all pooled particles are used.

cheers!

Actually it looks like rope.ropeBlueprint.restLength returns the value I would expect. When using the formula above the result would change based on how many times the cursor was called beforehand (in my current case that wouldn't have mattered, but figured I'd test it anyways).

Is there any foreseeable issue with me using rope.ropeBlueprint.restLength as a max length value? If so I could adjust the formula above to account for in-use particles.

Thank you for the help!
Reply
#4
(03-11-2020, 09:28 PM)VagabondOfHell Wrote: Actually it looks like rope.ropeBlueprint.restLength returns the value I would expect. When using the formula above the result would change based on how many times the cursor was called beforehand (in my current case that wouldn't have mattered, but figured I'd test it anyways).

Is there any foreseeable issue with me using rope.ropeBlueprint.restLength as a max length value? If so I could adjust the formula above to account for in-use particles.

Thank you for the help!

My bad: rope.ropeBlueprint.restLength does return the full length of the rope when all pooled particles are used, and is the easier solution. Sorry about the confusion!

I originally meant rope.restLength , which returns the rest length of the rope in its current state. Adding rope.ropeBlueprint.interParticleDistance * rope.ropeBlueprint.pooledParticles to it should also yield the full length.
Reply