Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to Shorten or Scale the Length of an Obi Rod
#5
Rods rely on chain constraints to keep their length constant. Chain constraints affect *all* particles in the rod simultaneously (since they're solved using a tridiagonal matrix solver, which considers all particles and solves for their total length directly instead of iteratively), so changing the length of a rod requires rebuilding the chain constraint which is quite expensive. You could disable chain constraints, but this will usually result in the rod stretching excessively. Also, bend/shear attributes are not stored on particles but on constraints, so you'd need to access and copy these when extending the rod. These are the reasons why changing the length of a rod is not currently supported.

If you don't need chain constraints and don't need to add/remove particles from the rod, a considerably simpler solution would be to just scale the restLengths of the rod's stretch/shear constraints. See this on how to access and modify constraint values attributes at runtime.

Note that such a solution will affect collision detection negatively, as gaps may open in between particles. Also, the "segments" in the rod may become more visible. This is probably OK if the maximum/minimum length range of your rod is not very large.

kind regards,
Reply


Messages In This Thread
RE: How to Shorten or Scale the Length of an Obi Rod - by josemendez - Yesterday, 09:43 AM