Loading...
Searching...
No Matches
GuidewireSim.CollisionSolvingStep Class Reference
Inheritance diagram for GuidewireSim.CollisionSolvingStep:

## Public Member Functions

void | SolveCollisionConstraints (Vector3[] spherePositionPredictions, int solverStep, int constraintSolverSteps)

## Private Member Functions

void | Awake ()
void | SolveCollisionConstraint (Vector3 spherePositionPrediction, Vector3 contactPoint, Vector3 collisionNormal, int solverStep, out Vector3 deltaPosition)
void | DrawCollisionInformation (Vector3 spherePositionPrediction, Vector3 contactPoint, Vector3 collisionNormal)
Vector3 | CalculateDeltaPosition (Vector3 spherePositionPrediction, Vector3 closestSurfacePoint, Vector3 normalVector)
void | CorrectCollisionPredictions (int sphereIndex, Vector3[] spherePositionPredictions, int solverStep, int constraintSolverSteps)

## Private Attributes

MathHelper | mathHelper
| The component MathHelper that provides math related helper functions. More...
CollisionHandler | collisionHandler
| The component CollisionHandler that tracks all collisions. More...
Vector3 | deltaPosition = new Vector3()
| The correction of `spherePositionPrediction` in method SolveCollisionConstraint(). More...
Vector3 | initialPositionPrediction = new Vector3()
float | sphereRadius = 5f
| The radius of a sphere of the guidewire. More...
float | collisionMargin = 0.1f
float | collisionStiffness = 0.001f
| The collision constraint stiffness parameter. More...

## Detailed Description

This class implements the collision solving that is part of the constraint solving step.

## Member Function Documentation

## Awake()

void GuidewireSim.CollisionSolvingStep.Awake | ( |  | ) |

private

## CalculateDeltaPosition()

Vector3 GuidewireSim.CollisionSolvingStep.CalculateDeltaPosition | ( | Vector3 | spherePositionPrediction,
|  | Vector3 | closestSurfacePoint,
|  | Vector3 | normalVector
| ) |  |

private

Calculates the displacement of the collision constraint.

Parameters

  spherePositionPredictions | The prediction of the position at the current frame of each sphere (in this case of the last frame).
  closestSurfacePoint | The contact point of the collision.
  normalVector | The collision normal.

Returns
  The delta position, i.e. the calculated displacement.

## CorrectCollisionPredictions()

void GuidewireSim.CollisionSolvingStep.CorrectCollisionPredictions | ( | int | sphereIndex,
|  | Vector3[] | spherePositionPredictions,
|  | int | solverStep,
|  | int | constraintSolverSteps
| ) |  |

private

Corrects the position prediction of the sphere of `sphereIndex` with the calculated displacement.

Parameters

  sphereIndex | The sphere ID of the colliding sphere.
  spherePositionPredictions | The prediction of the position at the current frame of each sphere (in this case of the last frame).
  solverStep | The current iteration of the constraint solving step.
  constraintSolverSteps | The total number of solver steps of the constraint solving step.

## DrawCollisionInformation()

void GuidewireSim.CollisionSolvingStep.DrawCollisionInformation | ( | Vector3 | spherePositionPrediction,
|  | Vector3 | contactPoint,
|  | Vector3 | collisionNormal
| ) |  |

private

Draws the contact point, collision normal, and displacement corrections into the scene of the collision that occured.

Parameters

  spherePositionPrediction | The position prediction of the sphere that collided.
  contactPoint | The contact point of the collision.
  collisionNormal | The normal of the collision.

## SolveCollisionConstraint()

void GuidewireSim.CollisionSolvingStep.SolveCollisionConstraint | ( | Vector3 | spherePositionPrediction,
|  | Vector3 | contactPoint,
|  | Vector3 | collisionNormal,
|  | int | solverStep,
|  | out Vector3 | deltaPosition
| ) |  |

private

Solves the collision constraint for one collision that occured this frame.

Parameters

  spherePositionPredictions | The prediction of the position at the current frame of each sphere (in this case of the last frame).
  contactPoint | The contact point of the collision.
  collisionNormal | The normal of the collision.
  solverStep | The current iteration of the constraint solving step.

Attention
  Current calculation of the normal only works for spheres.

## SolveCollisionConstraints()

void GuidewireSim.CollisionSolvingStep.SolveCollisionConstraints | ( | Vector3[] | spherePositionPredictions,
|  | int | solverStep,
|  | int | constraintSolverSteps
| ) |  |

Is responsible for executing one iteration of the constraint solving step for the collision constraint of each collision of this frame.

Parameters

  spherePositionPredictions | The prediction of the position at the current frame of each sphere (in this case of the last frame).
  solverStep | The current iteration of the constraint solving step.
  constraintSolverSteps | The total number of solver steps of the constraint solving step.

## Member Data Documentation

## collisionHandler

CollisionHandler GuidewireSim.CollisionSolvingStep.collisionHandler

private

The component CollisionHandler that tracks all collisions.

## collisionMargin

float GuidewireSim.CollisionSolvingStep.collisionMargin = 0.1f

private

A margin by which a colliding element of the guidewire is set away from the object colliding with in the direction of the normal.

Note
  Without this margin, the colliding element of the guidewire (e.g. a sphere) is corrected such that its surface exactly touches the object colliding with, which results in the guidewire still penetrating the object.

## collisionStiffness

float GuidewireSim.CollisionSolvingStep.collisionStiffness = 0.001f

private

The collision constraint stiffness parameter.

## deltaPosition

Vector3 GuidewireSim.CollisionSolvingStep.deltaPosition = new Vector3()

private

The correction of `spherePositionPrediction` in method SolveCollisionConstraint().

## initialPositionPrediction

Vector3 GuidewireSim.CollisionSolvingStep.initialPositionPrediction = new Vector3()

private

## mathHelper

MathHelper GuidewireSim.CollisionSolvingStep.mathHelper

private

The component MathHelper that provides math related helper functions.

## sphereRadius

float GuidewireSim.CollisionSolvingStep.sphereRadius = 5f

private

The radius of a sphere of the guidewire.

The documentation for this class was generated from the following file:

- CollisionSolvingStep.cs