![]() |
Help Max Rest Length - 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 Max Rest Length (/thread-2562.html) |
Max Rest Length - VagabondOfHell - 01-11-2020 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! RE: Max Rest Length - josemendez - 03-11-2020 (01-11-2020, 10:12 PM)VagabondOfHell Wrote: Hi Obi 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! RE: Max Rest Length - VagabondOfHell - 03-11-2020 (03-11-2020, 09:42 AM)josemendez Wrote: Hi there! 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! RE: Max Rest Length - josemendez - 04-11-2020 (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). 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. |