Thanks for the response! Excellent support here as usual
I was wondering if you could please post a good example of how to use the solver externalForces array. I tried the code below, but this is throwing a NullReferenceException runtime error on the for loop line.
In fact, this experiment below produced both a NullReferenceException runtime error, and the actual length of the array in the console
I was wondering if you could please post a good example of how to use the solver externalForces array. I tried the code below, but this is throwing a NullReferenceException runtime error on the for loop line.
Code:
public ObiRope myRope; //this is assigned in Start()
private void FixedUpdate()
{
for (int i = 0; i < myRope.solverIndices.Length; ++i)
myRope.solver.externalForces[i] = myForce;
}
In fact, this experiment below produced both a NullReferenceException runtime error, and the actual length of the array in the console
Code:
private void FixedUpdate()
{
Debug.Log("myRope.solverIndices.Length: " + myRope.solverIndices.Length);
}
NullReferenceException: Object reference not set to an instance of an object
ObiRopePlanetGravity.FixedUpdate () (at Assets/ObiRopePlanetGravity.cs:55)
myRope.solverIndices.Length: 10
UnityEngine.Debug:Log (object)
ObiRopePlanetGravity:FixedUpdate () (at Assets/ObiRopePlanetGravity.cs:55)