Commit b41902f7 authored by rv3Dcv's avatar rv3Dcv

Remove execution time measurement

Also add clean code
parent 72bac8b8
......@@ -7,6 +7,10 @@ using UnityEngine.Assertions;
namespace GuidewireSim
{
/**
* This class is responsible for tracking collisions of the object it is attached to. Attach this component only to sphere objects
* of the guidewire.
*/
public class CollisionDetectionPrimitive : MonoBehaviour
{
SimulationLoop simulationLoop; //!< The SimulationLoop component in the Simulation GameObject
......@@ -31,6 +35,9 @@ namespace GuidewireSim
AssignSphereID();
}
/**
* Assigns the unique ID of the object sphere it is attached to to #sphereID.
*/
private void AssignSphereID()
{
GameObject thisSphere = this.transform.gameObject;
......@@ -47,6 +54,9 @@ namespace GuidewireSim
Debug.LogWarning("No sphereID could be assigned.");
}
/**
* Registers a collision that Unity's collision detection detected.
*/
private void OnCollisionEnter(Collision other)
{
Debug.Log("trigger " + transform.name);
......@@ -54,90 +64,14 @@ namespace GuidewireSim
collisionHandler.RegisterCollision(this.transform, other, sphereID);
}
/**
* Registers a collision that Unity's collision detection detected.
*/
private void OnCollisionStay(Collision other)
{
Debug.Log("trigger " + transform.name);
collisionHandler.RegisterCollision(this.transform, other, sphereID);
}
// private void OnTriggerEnter(Collider other)
// {
// Debug.Log("trigger " + transform.name);
// if (!insideCollision)
// {
// collisionHandler.RegisterCollision(this.transform, other, sphereID);
// Debug.Log("pos" + this.transform.position);
// Debug.Log("colpos" + this.transform.GetComponent<SphereCollider>().center);
// Debug.Log("otherpos" + other.transform.position);
// Vector3 otherClosestPoint = other.ClosestPoint(this.transform.position);
// Debug.Log("otherclosestpoint" + otherClosestPoint.ToString("e4"));
// Debug.Log("thisclosestpoint" + this.transform.GetComponent<SphereCollider>().ClosestPoint(otherClosestPoint).ToString("e4"));
// Vector3 thisclosestpoint2 = this.transform.GetComponent<SphereCollider>().ClosestPoint(other.transform.position);
// Debug.Log("thisclosestpoint2" + thisclosestpoint2.ToString("e4"));
// Vector3 DiffCollisionPointToCenter = thisclosestpoint2 - (this.transform.position + this.transform.GetComponent<SphereCollider>().center);
// Debug.Log("DiffCollisionPointToCenter" + DiffCollisionPointToCenter.ToString("e4"));
// }
// }
// private void OnTriggerStay(Collider other)
// {
// Debug.Log("trigger " + transform.name);
// if (!insideCollision)
// {
// collisionHandler.RegisterCollision(this.transform, other, sphereID);
// }
// }
// private void OnTriggerExit(Collider other)
// {
// if (insideCollision)
// {
// Debug.Log("trigger " + transform.name);
// collisionHandler.RegisterCollision(this.transform, other, sphereID);
// }
// }
// private void OnCollisionEnter(Collision other)
// {
// Debug.Log("trigger " + transform.name);
// // needed to use ClosestPoint().
// // other.collider.GetComponent<MeshCollider>().convex = true;
// collisionHandler.RegisterCollision(this.transform, other, sphereID);
// // Debug.Log(other.GetContact(0).normal.ToString("e2"));
// // if (!insideCollision)
// // {
// // collisionHandler.RegisterCollision(this.transform, other, sphereID);
// // Debug.Log("pos" + this.transform.position);
// // Debug.Log("colpos" + this.transform.GetComponent<SphereCollider>().center);
// // Debug.Log("otherpos" + other.transform.position);
// // other.collider.GetComponent<MeshCollider>().convex = true;
// // Vector3 otherClosestPoint = other.collider.ClosestPoint(this.transform.position);
// // Debug.Log("otherclosestpoint" + otherClosestPoint.ToString("e4"));
// // Debug.Log("thisclosestpoint" + this.transform.GetComponent<SphereCollider>().ClosestPoint(otherClosestPoint).ToString("e4"));
// // Vector3 thisclosestpoint2 = this.transform.GetComponent<SphereCollider>().ClosestPoint(other.transform.position);
// // Debug.Log("thisclosestpoint2" + thisclosestpoint2.ToString("e4"));
// // Vector3 DiffCollisionPointToCenter = thisclosestpoint2 - (this.transform.position + this.transform.GetComponent<SphereCollider>().center);
// // Debug.Log("DiffCollisionPointToCenter" + DiffCollisionPointToCenter.ToString("e4"));
// // }
// }
}
}
\ No newline at end of file
......@@ -5,6 +5,10 @@ using UnityEngine.Assertions;
namespace GuidewireSim
{
/**
* Similarly to CollisionDetectionPrimitive, this class is responsible for tracking collisions of the object it is attached to.
* Attach this component only to blood vessel objects.
*/
public class CollisionDetectionVessel : MonoBehaviour
{
SimulationLoop simulationLoop; //!< The SimulationLoop component in the Simulation GameObject
......@@ -18,6 +22,7 @@ namespace GuidewireSim
collisionHandler = FindObjectOfType<CollisionHandler>();
Assert.IsNotNull(collisionHandler);
}
// private void OnCollisionEnter(Collision other)
// {
// // ContactPoint contactPoint = other.GetContact(0);
......
......@@ -6,6 +6,9 @@ using UnityEngine.Assertions;
namespace GuidewireSim
{
/**
* This class manages all collisions that should be resolved, i.e. the collisions of the last frame.
*/
public class CollisionHandler : MonoBehaviour
{
public List<CollisionPair> registeredCollisions; //!< All collisions that occured between the last and the current frame in OnTriggerEnter.
......@@ -17,30 +20,43 @@ namespace GuidewireSim
*/
float sphereRadius = 5f; //!< The radius of the sphere elements of the guidewire.
public bool collided = false;
private void Start()
{
registeredCollisions = new List<CollisionPair>();
}
public void RegisterCollision(Transform sphere, Collision vesselCollider, int sphereID)
/**
* Registers a collision by adding it to #registeredCollisions.
* @param sphere The sphere of the guidewire that collided.
* @param collision The Collision instance.
* @param sphereID The unique ID of @p sphere.
*/
public void RegisterCollision(Transform sphere, Collision collision, int sphereID)
{
CollisionPair registeredCollision = new CollisionPair(sphere, vesselCollider, sphereID);
CollisionPair registeredCollision = new CollisionPair(sphere, collision, sphereID);
registeredCollisions.Add(registeredCollision);
collided = true;
}
/**
* Clears the list of all registered collisions.
*/
public void ResetRegisteredCollisions()
{
registeredCollisions.Clear();
}
/**
* Sets the position of the collider of each sphere to the sphere's position prediction.
* @note The position of the collider is implicitly set by setting the colliders center argument.
* @param spheresCount The count of all spheres of the guidewire. Equals the length of @p spherePositionPredictions.
* @param spherePositionPredictions The prediction of the position at the current frame of each sphere (in this case of the last frame).
* @param spherePositions The position at the current frame of each sphere.
*/
public void SetCollidersToPredictions(int spheresCount, Vector3[] spherePositionPredictions, Vector3[] spherePositions)
{
for (int sphereIndex = 0; sphereIndex < spheresCount; sphereIndex++)
{
// Siehe Blatt 10 für die Berechnung von .center
Vector3 centerPosition = (spherePositionPredictions[sphereIndex] - spherePositions[sphereIndex]) / (2 * sphereRadius);
sphereColliders[sphereIndex].center = centerPosition;
}
......
......@@ -4,11 +4,14 @@ using UnityEngine;
namespace GuidewireSim
{
/**
* Carries all information of a collision that occured.
*/
public struct CollisionPair
{
public Transform sphere;
public Collision vesselCollider;
public int sphereID;
public Transform sphere; //!< The sphere object of the guidewire that was part of the collision.
public Collision vesselCollider; //!< The blood vessel object that was part of the collision.
public int sphereID; //!< The ID of the sphere object of the guidewire that was part of the collision.
public CollisionPair(Transform sphere, Collision vesselCollider, int sphereID)
{
......
......@@ -5,6 +5,9 @@ using UnityEngine.Assertions;
namespace GuidewireSim
{
/**
* This class implements the collision solving that is part of the constraint solving step.
*/
public class CollisionSolvingStep : MonoBehaviour
{
MathHelper mathHelper; //!< The component MathHelper that provides math related helper functions.
......@@ -31,60 +34,41 @@ namespace GuidewireSim
Assert.IsNotNull(collisionHandler);
}
/**
* Is responsible for executing one iteration of the constraint solving step for the collision constraint
* of each collision of this frame.
* @param spherePositionPredictions The prediction of the position at the current frame of each sphere (in this case of the last frame).
* @param solverStep The current iteration of the constraint solving step.
* @param constraintSolverSteps The total number of solver steps of the constraint solving step.
*/
public void SolveCollisionConstraints(Vector3[] spherePositionPredictions, int solverStep, int constraintSolverSteps)
{
// Debug.Log("Collision Count " + collisionHandler.registeredCollisions.Count);
for (int collisionIndex = 0; collisionIndex < collisionHandler.registeredCollisions.Count; collisionIndex++)
{
CollisionPair collisionPair = collisionHandler.registeredCollisions[collisionIndex];
int sphereID = collisionPair.sphereID;
Vector3 spherePositionPrediction = spherePositionPredictions[sphereID];
// Debug.Log("Contact Count" + collisionPair.vesselCollider.contactCount);
// Vector3 computedNormal = collisionPair.vesselCollider.GetContact(0).normal;
// Vector3 lineCenterPointToCenterPoint = spherePositionPrediction - collisionPair.vesselCollider.transform.position;
// Vector3 deviation = computedNormal - lineCenterPointToCenterPoint.normalized;
// Debug.Log("deviation" + deviation.ToString("e3"));
SolveCollisionConstraint(spherePositionPrediction, collisionPair, solverStep, out deltaPosition);
CorrectCollisionPredictions(sphereID, spherePositionPredictions, solverStep, constraintSolverSteps);
}
// Pauses the simulation after the first collision has been resolved.
// if (collisionHandler.registeredCollisions.Count >= 1)
// {
// Time.timeScale = 0f;
// }
}
// @attention Current calculation of the normal only works for spheres.
/**
* Solves the collision constraint for one collision that occured this frame.
* @param spherePositionPredictions The prediction of the position at the current frame of each sphere (in this case of the last frame).
* @param collisionPair An instance that carries all information of a collision that occured.
* @param solverStep The current iteration of the constraint solving step.
* @attention Current calculation of the normal only works for spheres.
*/
protected virtual void SolveCollisionConstraint(Vector3 spherePositionPrediction, CollisionPair collisionPair, int solverStep,
out Vector3 deltaPosition)
{
// int sphereID = collisionPair.sphereID;
ContactPoint contactPoint = collisionPair.vesselCollider.GetContact(0);
Vector3 otherPosition = contactPoint.otherCollider.transform.position;
// solution one
// there is a difference between closest point to transform.position and closest point to position prediction.
// closestSurfacePoint = collisionPair.vesselCollider.collider.ClosestPoint(spherePositionPrediction);
// normalVector = contactPoint.normal;
// solution two
float otherRadius = 15f;
Vector3 closestSurfacePoint = otherPosition + otherRadius * (spherePositionPrediction - otherPosition).normalized;
Vector3 normalVector = (spherePositionPrediction - otherPosition).normalized;
//solution three
// closestSurfacePoint = contactPoint.point;
// normalVector = (closestSurfacePoint - otherPosition).normalized;
Vector3 closestSurfacePoint = contactPoint.point;
Vector3 normalVector = contactPoint.normal;
if (solverStep == 0)
{
......@@ -92,100 +76,15 @@ namespace GuidewireSim
}
deltaPosition = CalculateDeltaPosition(spherePositionPrediction, closestSurfacePoint, normalVector);
// Debug.Log("solveCollConstraint");
// Vector3 pq = new Vector3();
// float[,] nnT = new float[3,3];
// float[,] nnTInverse = new float[3,3];
// Vector3 nTnnTInverse = new Vector3();
// float nTnnTInversepq = new float();
// Vector3 nTnnTInversepqn = new Vector3();
// Vector3 prnqc = new Vector3();
// Vector3 bloodVesselCenterPoint = collisionPair.vesselCollider.transform.position;
// Vector3 closestSurfacePoint2 = otherObject.point;
// Debug.Log("closestSurfacePoint " + closestSurfacePoint.ToString("e3"));
// Debug.Log("closestSurfacePoint2 " + closestSurfacePoint2.ToString("e3"));
// Debug.Log("spherePosition" + collisionPair.sphere.position);
// Debug.Log("spherePositionPrediction" + spherePositionPrediction);
// Debug.Log("closestSurfacePoint" + closestSurfacePoint);
// Debug.Log("bloodVesselCenterPoint" + bloodVesselCenterPoint);
// if (insideCollision)
// {
// normalVector = (bloodVesselCenterPoint - closestSurfacePoint).normalized;
// }
// else
// {
// normalVector = (closestSurfacePoint - bloodVesselCenterPoint).normalized;
// }
// Debug.Log("normalVector" + normalVector.ToString("e2"));
// pq = spherePositionPrediction - closestSurfacePoint;
// Debug.Log("pq" + pq);
// nnT = mathHelper.VectorColumnVectorMultiplication(normalVector, normalVector);
// for (int i = 0; i < 3; i++)
// {
// for (int j = 0; j < 3; j++)
// {
// Debug.Log("nnT [" + i + "," + j + "] " + nnT[i,j]);
// }
// }
// nnTInverse = mathHelper.MatrixInverse(nnT);
// for (int i = 0; i < 3; i++)
// {
// for (int j = 0; j < 3; j++)
// {
// Debug.Log("nnTInverse [" + i + "," + j + "] " + nnTInverse[i,j]);
// }
// }
// nTnnTInverse = mathHelper.ColumnVectorMatrixMultiplication(normalVector, nnTInverse);
// Debug.Log("nTnnTInverse" + nTnnTInverse);
// nTnnTInversepq = Vector3.Dot(nTnnTInverse, pq);
// nTnnTInversepqn = nTnnTInversepq * normalVector;
// deltaPosition = - nTnnTInversepqn;
// Debug.Log("deltaPosition: " + deltaPosition);
// deltaPosition = spherePositionPrediction - closestSurfacePoint;
// Debug.Log("p" + spherePositionPrediction);
// Debug.Log("q" + closestSurfacePoint);
// Debug.Log("prnq" + prnq);
// Vector3 absNormalVector = new Vector3();
// for (int vectorIndex = 0; vectorIndex < 3; vectorIndex++)
// {
// absNormalVector[vectorIndex] = Mathf.Abs(normalVector[vectorIndex]);
// }
// float nTn = Vector3.Dot(absNormalVector, absNormalVector);
// float pqn = Vector3.Dot(pq, normalVector);
// Debug.Log("ntn" + nTn);
// Debug.Log("pqn" + pqn);
// float factor = - pqn / nTn;
// Debug.Log("factor" + factor);
// prnqc = prnq - collisionMargin * normalVector;
// deltaPosition = factor * normalVector;
}
/**
* Draws the contact point, collision normal, and displacement corrections into the scene.
*/
protected void DrawCollisionInformation(Vector3 spherePositionPrediction, ContactPoint contactPoint, Vector3 otherPosition,
Vector3 closestSurfacePoint, Vector3 normalVector)
{
Debug.DrawLine(closestSurfacePoint, closestSurfacePoint + 10f * normalVector, Color.blue, 2f);
// Debug.DrawLine(otherPosition, spherePositionPrediction, Color.yellow, 2f);
DebugExtension.DrawPoint(spherePositionPrediction, Color.white);
......@@ -193,12 +92,25 @@ namespace GuidewireSim
DebugExtension.DrawPoint(closestSurfacePoint, Color.yellow);
}
/**
* Calculates the displacement of the collision constraint.
* @param spherePositionPredictions The prediction of the position at the current frame of each sphere (in this case of the last frame).
* @param closestSurfacePoint The contact point of the collision.
* @param normalVector The collision normal.
* @return The delta position, i.e. the calculated displacement.
*/
protected Vector3 CalculateDeltaPosition(Vector3 spherePositionPrediction, Vector3 closestSurfacePoint, Vector3 normalVector)
{
// return - (spherePositionPrediction - sphereRadius * normalVector - closestSurfacePoint);
return - (spherePositionPrediction - sphereRadius * normalVector - closestSurfacePoint - collisionMargin * normalVector);
}
/**
* Corrects the position prediction of the sphere of @p sphereIndex with the calculated displacement.
* @param sphereIndex The sphere ID of the colliding sphere.
* @param spherePositionPredictions The prediction of the position at the current frame of each sphere (in this case of the last frame).
* @param solverStep The current iteration of the constraint solving step.
* @param constraintSolverSteps The total number of solver steps of the constraint solving step.
*/
private void CorrectCollisionPredictions(int sphereIndex, Vector3[] spherePositionPredictions, int solverStep, int constraintSolverSteps)
{
Assert.IsTrue(sphereIndex >= 0);
......
......@@ -4,6 +4,9 @@ using UnityEngine;
namespace GuidewireSim
{
/**
* A specilization of CollisionSolvingStep that uses Unity's provided collision data.
*/
public class CollisionSolvingStep_UnityVariant : CollisionSolvingStep
{
protected override void SolveCollisionConstraint(Vector3 spherePositionPrediction, CollisionPair collisionPair, int solverStep,
......@@ -13,11 +16,7 @@ namespace GuidewireSim
Vector3 otherPosition = contactPoint.otherCollider.transform.position;
Vector3 closestSurfacePoint = contactPoint.point;
// Vector3 normalVector = (closestSurfacePoint - otherPosition).normalized;
Vector3 normalVector = contactPoint.normal;
// Debug.Log(normalVector.ToString("e2"));
// Debug.Log(closestSurfacePoint.ToString("e5"));
// Debug.Log((40-Mathf.Sqrt(50) - closestSurfacePoint[2]).ToString("e5"));
if (solverStep == 0)
{
......@@ -25,10 +24,6 @@ namespace GuidewireSim
}
deltaPosition = CalculateDeltaPosition(spherePositionPrediction, closestSurfacePoint, normalVector);
// Vector3 correction = spherePositionPrediction + 0.001f * deltaPosition;
// float difference = Vector3.Distance(spherePositionPrediction, correction);
// Debug.Log(difference.ToString("e3"));
}
}
}
\ No newline at end of file
......@@ -356,18 +356,10 @@ public class ConstraintSolvingStep : MonoBehaviour
Assert.IsTrue(sphereIndex >= 0);
Assert.AreApproximatelyEqual(1f, mathHelper.QuaternionLength(cylinderOrientationPredictions[sphereIndex]), tolerance: 0.01f);
// spherePositionPredictions[sphereIndex] += Mathf.Pow(1 - (1 - stretchStiffness), 1 / 1000f) * deltaPositionOne;
// spherePositionPredictions[sphereIndex + 1] += Mathf.Pow(1 - (1 - stretchStiffness), 1 / 1000f) * deltaPositionTwo;
// cylinderOrientationPredictions[sphereIndex] += Mathf.Pow(1 - (1 - stretchStiffness), 1 / 1000f) * deltaOrientation;
spherePositionPredictions[sphereIndex] += stretchStiffness * deltaPositionOne;
spherePositionPredictions[sphereIndex + 1] += stretchStiffness * deltaPositionTwo;
cylinderOrientationPredictions[sphereIndex] += stretchStiffness * deltaOrientation;
// spherePositionPredictions[sphereIndex] += deltaPositionOne;
// spherePositionPredictions[sphereIndex + 1] += deltaPositionTwo;
// cylinderOrientationPredictions[sphereIndex] += deltaOrientation;
cylinderOrientationPredictions[sphereIndex].Normalize();
Assert.AreApproximatelyEqual(1f, mathHelper.QuaternionLength(cylinderOrientationPredictions[sphereIndex]), tolerance: 0.01f);
......@@ -387,15 +379,9 @@ public class ConstraintSolvingStep : MonoBehaviour
Assert.AreApproximatelyEqual(1f, mathHelper.QuaternionLength(cylinderOrientationPredictions[cylinderIndex]), tolerance: 0.01f);
Assert.AreApproximatelyEqual(1f, mathHelper.QuaternionLength(cylinderOrientationPredictions[cylinderIndex + 1]), tolerance: 0.01f);
// cylinderOrientationPredictions[cylinderIndex] += Mathf.Pow(1 - (1 - bendStiffness), 1 / 1000f) * deltaOrientationOne;
// cylinderOrientationPredictions[cylinderIndex + 1] += Mathf.Pow(1 - (1 - bendStiffness), 1 / 1000f) * deltaOrientationTwo;
cylinderOrientationPredictions[cylinderIndex] += bendStiffness * deltaOrientationOne;
cylinderOrientationPredictions[cylinderIndex + 1] += bendStiffness * deltaOrientationTwo;
// cylinderOrientationPredictions[cylinderIndex] += deltaOrientationOne;
// cylinderOrientationPredictions[cylinderIndex + 1] += deltaOrientationTwo;
cylinderOrientationPredictions[cylinderIndex].Normalize();
cylinderOrientationPredictions[cylinderIndex + 1].Normalize();
......
......@@ -35,7 +35,6 @@ public class DirectorsDrawer : MonoBehaviour
DrawDirectors(simulationLoop.cylinderPositions, simulationLoop.directors);
}
/**
* Draws the director basis of each orientation element as arrows.
* @param cylinderPositions The center of mass of each cylinder, i.e. the position of each orientation element.
......
......@@ -29,18 +29,13 @@ public class PredictionStep : MonoBehaviour
*/
public Vector3[] PredictSphereVelocities(Vector3[] sphereVelocities, float[] sphereInverseMasses, Vector3[] sphereExternalForces)
{
// Debug.Log("dt " + Time.deltaTime + " fdt " + Time.fixedDeltaTime);
Vector3 calc = Time.deltaTime * sphereInverseMasses[1] * sphereExternalForces[1];
// Debug.Log("dt " + Time.deltaTime + " invMass " + sphereInverseMasses[1] + " extF " + sphereExternalForces[1].ToString("e3")
// + " calc " + calc.ToString("e3") + " vorherigeVel " + sphereVelocities[1].ToString("e3"));
for (int sphereIndex = 0; sphereIndex < sphereVelocities.Length; sphereIndex++)
{
sphereVelocities[sphereIndex] += Time.deltaTime * sphereInverseMasses[sphereIndex] * sphereExternalForces[sphereIndex];
}
// Debug.Log("velocity " + sphereVelocities[1].ToString("e3"));
return sphereVelocities;
}
......
......@@ -101,17 +101,6 @@ public class SimulationLoop : MonoBehaviour
public int SpheresCount { get; private set; } //!< The count of all #spheres of the guidewire.
public int CylinderCount { get; private set; } //!< The count of all #cylinders of the guidewire.
float elapsedTime = 0;
float timeConstraintSolving = 0;
float timeUpdateStep = 0;
float timePredictionStep = 0;
float timeAdaptCalculationsStep = 0;
float timeSetCollidersStep = 0;
float timeCompleteFrame = 0;
float timeCompleteFrameMeasure = 0;
float timeMeasure = 0;
float measurePoint = 5f;
private void Awake()
{
Assert.IsFalse(spheres.Length == 0);
......@@ -162,8 +151,6 @@ public class SimulationLoop : MonoBehaviour
if (ExecuteSingleLoopTest) return;
PerformSimulationLoop();
elapsedTime += Time.deltaTime;
}
/**
......@@ -204,49 +191,11 @@ public class SimulationLoop : MonoBehaviour
*/
public void PerformSimulationLoop()
{
if (collisionHandler.collided)
{
timeMeasure = Time.realtimeSinceStartup;
timeCompleteFrameMeasure = Time.realtimeSinceStartup;
}
PerformConstraintSolvingStep();
if (collisionHandler.collided)
{
timeConstraintSolving = Time.realtimeSinceStartup - timeMeasure;
timeMeasure = Time.realtimeSinceStartup;
}
PerformUpdateStep();
if (collisionHandler.collided)
{
timeUpdateStep = Time.realtimeSinceStartup - timeMeasure;
timeMeasure = Time.realtimeSinceStartup;
}
PerformPredictionStep();
if (collisionHandler.collided)
{
timePredictionStep = Time.realtimeSinceStartup - timeMeasure;
timeMeasure = Time.realtimeSinceStartup;
}
AdaptCalculations();
if (collisionHandler.collided)
{
timeAdaptCalculationsStep = Time.realtimeSinceStartup - timeMeasure;
timeMeasure = Time.realtimeSinceStartup;
}
SetCollidersStep();
if (collisionHandler.collided)
{
timeSetCollidersStep = Time.realtimeSinceStartup - timeMeasure;
timeCompleteFrame = Time.realtimeSinceStartup - timeCompleteFrameMeasure;
Time.timeScale = 0f;
Debug.Log("execution time constraint solving: " + timeConstraintSolving.ToString("F7"));
Debug.Log("execution time update step: " + timeUpdateStep.ToString("F7"));
Debug.Log("execution time prediction step: " + timePredictionStep.ToString("F7"));
Debug.Log("execution time adapt calculations: " + timeAdaptCalculationsStep.ToString("F7"));
Debug.Log("execution time set colliders: " + timeSetCollidersStep.ToString("F7"));
Debug.Log("execution time whole frame: " + timeCompleteFrame.ToString("F7"));
}
}
/**
......
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