publicGameObjectspherePrefab;//This is for choosing a Prefab for the sphere element. One can directly gain this in Robins code from: Assets/Guidewire_Assets/Prefabs
publicGameObjectcylinderPrefab;//This is for choosing a Prefab for the cylinder element. One can directly gain this in Robins code from: Assets/Guidewire_Assets/Prefabs
privateintspheresCount;//This variable is used to store the number of spheres in the guidewire, so the script can keep knowledge on how many spheres were created
privateGameObject[]spheres;//This array is used to store references to the sphere game objects in the guidewire. //This array is used to store references to the sphere game objects in the guidewire.
//This code segment is responsible for creating and positioning the spheres and cylinders
publicvoidCreateGuidewire(intnumberElements)
{
spheres=newGameObject[numberElements];
cylinders=newGameObject[numberElements-1];
//Here we use GetComponent to recieve the value of the variable rodElementLength that is stored in the SimulationLoop script. As this variable needs to be private, we use a getter Method and therefore also call this instead of calling the variable directly.
@@ -52,28 +65,25 @@ public class CreationScript : MonoBehaviour
simulationLoop.SetSpheres(spheres);
simulationLoop.SetCylinders(cylinders);
}
//Here I save the positions of the spheres to a .txt file. The file path has to be adapted to the local network for the file one wants to save the positons to
@@ -23,17 +23,18 @@ public class GuidewireCreateManager : MonoBehaviour
return;// Exit if SimulationLoop is not found
}
// Get the Rod Element Length
//again we need to get the rod element length from the simulation loop script;
REL=simulationLoop.GetRodElementLength();
intnumberOfElements=(int)(L_0/REL)+1;// Calculate the desired number of elements
intnumberOfElements=(int)(L_0/REL)+1;//This calculates the number of elements that now make up the discretized guidewire. The number of elements depends on the rod element length
// Find the CreationScript component in the scene
//now find the CreationScript component in the scene, to create the guidewire with the wanted number of elements and rod element length.
//This will cause the total length of the guidewire to stay the same
* Initializes @p sphereInverseMasses with the default value of one at the start of the simulation.
* Initializes @p sphereInverseMasses with the default value of one at the start of the simulation. Edit: I (Alex Kreibich) adapt this so the total mass stays the same. The idea for how this works is described in my Bachelorthesis in the Methods Chapter
* @param spheresCount The count of all spheres of the guidewire. Equals the length of @p spherePositionPredictions.
* @param[out] sphereInverseMasses The constant inverse masses of each sphere.