Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Stitch Rope and Cloth
#4
Hi,

You're passing the last particle allocated as the index for your rope, which is incorrect:

Code:
rope.solverIndices.Length - 1;

This does not guarantee it to be an active particle, in fact, by default it will be an inactive one (as it's the last particle of the pool).

Ropes can be resized (new particles added/removed) or torn. Tearable cloth can also be torn. To avoid runtime allocation, this is accomplished by preallocating more particles than needed to simulate the rope/cloth and deactivating the excess particles. Then as the rope needs new particles, inactive particles are activated. Same for tearable cloth.

By default, the size of the preallocation pool is 100 (you can change this size in the rope blueprint, see "pooled particles"): http://obi.virtualmethodstudio.com/manua...setup.html).

This means that if your rope is made of 10 particles, it will allocate 110 particles (from 0 to 109) and only the first 10 are active at first. So by accessing rope.solverIndices.Length - 1; you're getting particle #109 which is inactive: invisible, not part of the simulation, and at 0,0,0.

What you want to use is rope.activeParticleCount - 1. (see ObiActor's API documentation for details). Keep in mind that if you use a cursor to resize the rope or you cut the rope, this particle may *not* be at one end of the rope.

kind regards,
Reply


Messages In This Thread
Stitch Rope and Cloth - by bubbbles - 21-01-2022, 06:15 AM
RE: Stitch Rope and Cloth - by josemendez - 21-01-2022, 08:41 AM
RE: Stitch Rope and Cloth - by bubbbles - 21-01-2022, 09:09 AM
RE: Stitch Rope and Cloth - by josemendez - 21-01-2022, 09:40 AM