Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Teleport() causing ArgumentOutOfRangeException error
#1
Hello,

I was using Teleport() to reset out of bounds players and noticed it kept throwing an ArgumentOutOfRangeException error each time (ObiSoftbody.cs Line 189).  
I'm using Unity 2022.3.21f1 and a fresh install of the latest Obi Softbody asset on a basic project.  

I updated the script as show below (duplicated and commented out old for comparison).  It got rid of the error, but I'm not sure if it's correct or could cause other problems.  Please advise.  

Code:
for (int j = 0; j < ac.batches[i].activeConstraintCount && j < ac.GetBatchCount(); ++j)
{
    sc.batches[j].orientations[batchOffset + i] = rotOffset * sc.batches[i].orientations[batchOffset + j];
}

//for (int j = 0; j < ac.batches[i].activeConstraintCount; ++j)
//{
//    sc.batches[j].orientations[batchOffset + i] = rotOffset * sc.batches[i].orientations[batchOffset + j];
//}


Thank you

HakJak
Reply
#2
Hi HakJak,

that code should read:

Code:
sc.batches[i].orientations[batchOffset + j] = rotOffset * sc.batches[i].orientations[batchOffset + j];


instead of


Code:
sc.batches[j].orientations[batchOffset + i] = rotOffset * sc.batches[i].orientations[batchOffset + j];


Notice the i and j variables in the left side of the = are swapped.

We should publish an update to address this one since Teleport() is a common operation.
Reply