Commit 39af84d5 authored by rv3Dcv's avatar rv3Dcv

Add collision tests

parent 4bb3aef7
......@@ -54,10 +54,10 @@ namespace GuidewireSim
}
// Pauses the simulation after the first collision has been resolved.
if (collisionHandler.registeredCollisions.Count >= 1)
{
Time.timeScale = 0f;
}
// if (collisionHandler.registeredCollisions.Count >= 1)
// {
// Time.timeScale = 0f;
// }
}
// @attention Current calculation of the normal only works for spheres.
......@@ -184,7 +184,7 @@ namespace GuidewireSim
protected void DrawCollisionInformation(Vector3 spherePositionPrediction, ContactPoint contactPoint, Vector3 otherPosition,
Vector3 closestSurfacePoint, Vector3 normalVector)
{
Debug.DrawLine(closestSurfacePoint, closestSurfacePoint + 20f * normalVector, Color.blue, 2f);
Debug.DrawLine(closestSurfacePoint, closestSurfacePoint + 10f * normalVector, Color.blue, 2f);
// Debug.DrawLine(otherPosition, spherePositionPrediction, Color.yellow, 2f);
DebugExtension.DrawPoint(spherePositionPrediction, Color.white);
......
......@@ -14,6 +14,7 @@ public class CollisionTestPerformer : MonoBehaviour
[SerializeField] bool doCollisionTestOne = false;
[SerializeField] bool doCollisionTestTwo = false;
[SerializeField] bool doCollisionTestThree = false;
[SerializeField] bool doCollisionTestFour = false;
float startTime = 0f;
private void Awake()
......@@ -36,6 +37,7 @@ public class CollisionTestPerformer : MonoBehaviour
if (doCollisionTestOne) PerformCollisionTestOne();
else if (doCollisionTestTwo) StartCoroutine(PerformCollisionTestTwo());
else if (doCollisionTestThree) StartCoroutine(PerformCollisionTestThree());
else if (doCollisionTestFour) StartCoroutine(PerformCollisionTestFour());
}
/**
......@@ -91,5 +93,23 @@ public class CollisionTestPerformer : MonoBehaviour
Debug.Log("Velocity at test end: " + simulationLoop.sphereVelocities[1].ToString("e2"));
Debug.Log("End of Pull Phase of Collision Test Three");
}
// force gets applied for the whole time
private IEnumerator PerformCollisionTestFour(float pullForceFactor = 0.3f)
{
float appliedPullForce = pullForceFactor * pullForce.z;
Debug.Log("Start of Collision Test Four");
Debug.Log("Pull Force: " + appliedPullForce);
for (int sphereIndex = 0; sphereIndex < (simulationLoop.SpheresCount - 1); sphereIndex++)
{
simulationLoop.sphereExternalForces[sphereIndex] = Vector3.zero;
}
simulationLoop.sphereExternalForces[simulationLoop.SpheresCount - 1] = pullForceFactor * pullForce;
yield return null;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: c32e3578b9818914ebc0a7f6f171ee0e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a1dd890c6b390c84fb024a55bcac5f3b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 68d980c6edc6d974982b61c94fef2804
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 439ef7b4a295aed4594c26ec502b2127
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a4568ee6b7dda714c8698153797a8a23
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -370,9 +370,13 @@ PrefabInstance:
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3901088838006394844, guid: 0e128b35dc3ea6746b6de609560d672d, type: 3}
propertyPath: doCollisionTestThree
propertyPath: doCollisionTestFour
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3901088838006394844, guid: 0e128b35dc3ea6746b6de609560d672d, type: 3}
propertyPath: doCollisionTestThree
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4233146888435007088, guid: 0e128b35dc3ea6746b6de609560d672d, type: 3}
propertyPath: m_RootOrder
value: 2
......@@ -453,8 +457,26 @@ PrefabInstance:
propertyPath: m_Name
value: Simulation
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 3537744961480436555, guid: 0e128b35dc3ea6746b6de609560d672d, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 0e128b35dc3ea6746b6de609560d672d, type: 3}
--- !u!1 &173875007 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4233146888435007114, guid: 0e128b35dc3ea6746b6de609560d672d, type: 3}
m_PrefabInstance: {fileID: 173875006}
m_PrefabAsset: {fileID: 0}
--- !u!114 &173875008
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 173875007}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f02fb1d019bf486469f64a89aa7a9ec1, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &334070158
GameObject:
m_ObjectHideFlags: 0
......@@ -738,7 +760,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 430987647}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 33.2, y: 3.81, z: 25.1}
m_LocalPosition: {x: 33.2, y: 8.28, z: 25.1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
......@@ -851,7 +873,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 449683293}
m_LocalRotation: {x: 0.66177, y: 0, z: 0, w: 0.7497069}
m_LocalPosition: {x: 12, y: 9.3, z: 30}
m_LocalPosition: {x: 12, y: 9.3, z: 18.4}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
......
fileFormatVersion: 2
guid: 78e5b7d453fb8d54a9fa8eead6840eaa
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -71,10 +71,6 @@ public class SimulationLoop : MonoBehaviour
* E.g. the first basis vector is (1, 0, 0), the second (0, 1, 0) and the third (0, 0, 1).
*/
public int ConstraintSolverSteps { get; set; } = 1000; /**< How often the constraint solver iterates over each constraint during
* the Constraint Solving Step.
* @attention This value must be positive.
*/
public bool ExecuteSingleLoopTest { get; set; } = false; /**< Whether or not to execute the Single Loop Test, in which the outer simulation loop
* is exactly executed once.
*/
......@@ -88,6 +84,13 @@ public class SimulationLoop : MonoBehaviour
* @attention Make sure that the guidewire setup fulfilles that the distance between two adjacent
* spheres is #rodElementLength.
*/
[SerializeField] [Range(1, 1000)] int constraintSolverSteps = 1000; /**< How often the constraint solver iterates over each constraint during
* the Constraint Solving Step.
* @attention This value must be positive.
*/
public int ConstraintSolverSteps { get { return constraintSolverSteps; }
set { constraintSolverSteps = value; } }
[SerializeField] [Range(0.002f, 0.04f)] float timeStep = 0.01f; /**< The fixed time step in seconds at which the simulation runs.
* @note A lower timestep than 0.002 can not be guaranteed by
* the test hardware to be executed in time. Only choose a lower timestep if
......
......@@ -6,34 +6,34 @@ EditorUserSettings:
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedScenePath-0:
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006e0a12e739163b1271e704001fef
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814cc001b14d71dfa2fc61608d22f1ddcc41cdff79bc3dae3ccf2
flags: 0
RecentlyUsedScenePath-1:
value: 224247031146467f080c192534315e071f191f0f343c233e3e20123dadc52c39eff73aeca81f273d3412e3394a2b0f36e613
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814cc001b14d71d8b0fc61608d2
flags: 0
RecentlyUsedScenePath-2:
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006f6931ff34012c042cbc1f0702e212
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019f511d51f860a12c20d05
flags: 0
RecentlyUsedScenePath-3:
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006d6931ff34012c042cbc1f0702e212
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019f511d51ff72a12c20d05f8cc0fd8e2dbc29affd6e2f3c1
flags: 0
RecentlyUsedScenePath-4:
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34d51e191f1e03cd0701fa5e061fcc0cdc
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06d540d1137f7180c18c93b18021c07e90707fa3d1602cd28cc0acd2029c51008d7fb1cc3ead4d8c0a4cde5eeccc7
flags: 0
RecentlyUsedScenePath-5:
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06c56701431fb1e10
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019f608cd1fda1a23fe1715dad42bd0f1dcd7dafe96fee9d1cac6
flags: 0
RecentlyUsedScenePath-6:
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a45e305031f08
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019e60dc71ff72a12c20d05f8cc0fd8e2dbc29affd6e2f3c1
flags: 0
RecentlyUsedScenePath-7:
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019f511d51f860a12c20d05
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019e60dc71ff72a12c20d05f8cc0fd8e2dbc2ebf8d7ffe6ccdbdbeee7faf9fae1
flags: 0
RecentlyUsedScenePath-8:
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814cc001b14d71d8b0fc61608d2
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019e60dc71ff72a12c20d05f8cc0fd8e2dbc2ebefdcece296cbd1a9e6ed
flags: 0
RecentlyUsedScenePath-9:
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814cc001b14d71dfa2fc61608d22f1ddcc41cdff79bc3dae3ccf2
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019e60dc71ff72a12c20d05f8cc0fd8e2dbc2ebc8dde7e8cffbdba7f7bae5e0f1e1e8
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment