21-01-2022, 09:40 AM
(This post was last modified: 21-01-2022, 09:50 AM by josemendez.)
Hi,
You're passing the last particle allocated as the index for your rope, which is incorrect:
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,
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,