Commit d6a25b7a authored by rv3Dcv's avatar rv3Dcv

Add PerformCollisionTestThree()

parent 449ee0d3
......@@ -13,6 +13,7 @@ public class CollisionTestPerformer : MonoBehaviour
[SerializeField] bool doCollisionTestOne = false;
[SerializeField] bool doCollisionTestTwo = false;
[SerializeField] bool doCollisionTestThree = false;
float startTime = 0f;
private void Awake()
......@@ -34,6 +35,7 @@ public class CollisionTestPerformer : MonoBehaviour
{
if (doCollisionTestOne) PerformCollisionTestOne();
else if (doCollisionTestTwo) StartCoroutine(PerformCollisionTestTwo());
else if (doCollisionTestThree) StartCoroutine(PerformCollisionTestThree());
}
/**
......@@ -49,6 +51,7 @@ public class CollisionTestPerformer : MonoBehaviour
simulationLoop.sphereExternalForces[simulationLoop.SpheresCount - 1] = pullForce;
}
// force gets applied for a fixed time
private IEnumerator PerformCollisionTestTwo(float applyForceTime = 1.5f)
{
for (int sphereIndex = 0; sphereIndex < (simulationLoop.SpheresCount - 1); sphereIndex++)
......@@ -68,23 +71,25 @@ public class CollisionTestPerformer : MonoBehaviour
Debug.Log("End of Pull Phase of Collision Test Two");
}
// private IEnumerator PerformCollisionTestThree(float exitVelocity = 4f)
// {
// for (int sphereIndex = 0; sphereIndex < (simulationLoop.SpheresCount - 1); sphereIndex++)
// {
// simulationLoop.sphereExternalForces[sphereIndex] = Vector3.zero;
// }
// force gets applied until a fixed velocity is reached
private IEnumerator PerformCollisionTestThree(float exitVelocity = 4f)
{
for (int sphereIndex = 0; sphereIndex < (simulationLoop.SpheresCount - 1); sphereIndex++)
{
simulationLoop.sphereExternalForces[sphereIndex] = Vector3.zero;
}
simulationLoop.sphereExternalForces[simulationLoop.SpheresCount - 1] = pullForce;
// simulationLoop.sphereExternalForces[simulationLoop.SpheresCount - 1] = pullForce;
// yield return new WaitForSeconds(applyForceTime);
yield return new WaitUntil(() => simulationLoop.sphereVelocities[simulationLoop.SpheresCount - 1].z >= exitVelocity);
// simulationLoop.sphereExternalForces[simulationLoop.SpheresCount - 1] = Vector3.zero;
simulationLoop.sphereExternalForces[simulationLoop.SpheresCount - 1] = Vector3.zero;
// float timeDiff = Time.time - startTime;
// Debug.Log("Elapsed time of collision test: " + timeDiff);
// Debug.Log("Velocity at test end: " + simulationLoop.sphereVelocities[1].ToString("e2"));
// Debug.Log("End of Pull Phase of Collision Test Two");
// }
float timeDiff = Time.time - startTime;
Debug.Log("Elapsed time of collision test: " + timeDiff);
Debug.Log("Velocity at test end: " + simulationLoop.sphereVelocities[1].ToString("e2"));
Debug.Log("End of Pull Phase of Collision Test Three");
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 0f3f7ca7ef13e6a4cabee61af553f355
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -367,6 +367,10 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3901088838006394844, guid: 0e128b35dc3ea6746b6de609560d672d, type: 3}
propertyPath: doCollisionTestTwo
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3901088838006394844, guid: 0e128b35dc3ea6746b6de609560d672d, type: 3}
propertyPath: doCollisionTestThree
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4233146888435007088, guid: 0e128b35dc3ea6746b6de609560d672d, type: 3}
......@@ -415,7 +419,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4233146888435007091, guid: 0e128b35dc3ea6746b6de609560d672d, type: 3}
propertyPath: timeStep
value: 0.002
value: 0.004
objectReference: {fileID: 0}
- target: {fileID: 4233146888435007091, guid: 0e128b35dc3ea6746b6de609560d672d, type: 3}
propertyPath: fixedTimeStep
......
......@@ -6,34 +6,34 @@ EditorUserSettings:
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedScenePath-0:
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f6b722c0ce6281d
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006f0a12e739163b1271e704001fef
flags: 0
RecentlyUsedScenePath-1:
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f00690a12e739163b1271e704001fef
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006e0a12e739163b1271e704001fef
flags: 0
RecentlyUsedScenePath-2:
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006f6931ff34012c042cbc1f0702e212
value: 224247031146467f080c192534315e071f191f0f343c233e3e20123dadc52c39eff73aeca81f273d3412e3394a2b0f36e613
flags: 0
RecentlyUsedScenePath-3:
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006d6931ff34012c042cbc1f0702e212
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006f6931ff34012c042cbc1f0702e212
flags: 0
RecentlyUsedScenePath-4:
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006e6931ff34012c042cbc1f0702e212
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006d6931ff34012c042cbc1f0702e212
flags: 0
RecentlyUsedScenePath-5:
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006f0a12e739163b1271e704001fef
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34d51e191f1e03cd0701fa5e061fcc0cdc
flags: 0
RecentlyUsedScenePath-6:
value: 224247031146467c18070827072a4d1529360b39293c357f1d3b1227edf42d28e7d435ece93f006e0a12e739163b1271e704001fef
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06c56701431fb1e10
flags: 0
RecentlyUsedScenePath-7:
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a45e305031f08
flags: 0
RecentlyUsedScenePath-8:
value: 224247031146467f080c192534315e071f191f0f343c233e3e20123dadc52c39eff73aeca81f273d3412e3394a2b0f36e613
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814cc001b14d71d8b0fc61608d2
flags: 0
RecentlyUsedScenePath-9:
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34d51e191f1e03cd0701fa5e061fcc0cdc
value: 224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019f511d51f860a12c20d05
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