This issue has nothing to do with the tactility implementation, and was observed before work began on it.
If the grabbable object (sphere) is being touched by both the left and right hands (not necessarily grabbing it but just simply touching) the internal state logic of the UniformGrabbable component becomes permanently desynchronized, resulting in an index-out-of-bounds exception on every frame:
This also means that pressure will not be calculated after this error occurs until the app is completely restarted.
More specifically, this issue is caused by a loss of maintained state synchronization between the _touchingBoneCapsules List and _touchingBonePressures Array, meaning some objects are removed from one array without their counterpart being removed from the other. Below are lines 61 to 62 of the UniformGrabbable script, where applied pressures are calculated for each physics capsule (finger bone):
for (var i = 0; i < _touchingBoneCapsules.Count; i++)
touchingBonePressures[i] = GetAppliedPressure(_touchingBoneCapsules[i]);
The indexing variable i cannot possibly be less than zero, which means that when the desynchronization happens, the _touchingBoneCapsules List must have become larger than the _touchingBonePressures Array, leading to indexing with a value that is equal to the size of the Array, which is illegal. This means that either items are removed prematurely from _touchingBonePressures or not removed in time from _touchingBoneCapsules.
This issue has nothing to do with the tactility implementation, and was observed before work began on it.
If the grabbable object (sphere) is being touched by both the left and right hands (not necessarily grabbing it but just simply touching) the internal state logic of the
UniformGrabbable
component becomes permanently desynchronized, resulting in an index-out-of-bounds exception on every frame:This also means that pressure will not be calculated after this error occurs until the app is completely restarted.
More specifically, this issue is caused by a loss of maintained state synchronization between the
_touchingBoneCapsules
List and_touchingBonePressures
Array, meaning some objects are removed from one array without their counterpart being removed from the other. Below are lines 61 to 62 of theUniformGrabbable
script, where applied pressures are calculated for each physics capsule (finger bone):The indexing variable
i
cannot possibly be less than zero, which means that when the desynchronization happens, the_touchingBoneCapsules
List must have become larger than the_touchingBonePressures
Array, leading to indexing with a value that is equal to the size of the Array, which is illegal. This means that either items are removed prematurely from_touchingBonePressures
or not removed in time from_touchingBoneCapsules
.