CollidersGetSqrDistanceToPartOrDefault Method |
Returns the minimum square distance to the nearest point on the part's collider surface.
Namespace:
KSPDev.ModelUtils
Assembly:
KSPDev_Utils.1.1 (in KSPDev_Utils.1.1.dll) Version: 1.1 for KSP v1.6+
Syntaxpublic static float GetSqrDistanceToPartOrDefault(
Vector3 point,
Part part,
float defaultValue = ∞f,
Func<Collider, bool> filterFn = null
)
Request Example
View SourceParameters
- point
- Type: UnityEngineVector3
The reference point to find distance for. - part
- Type: (Default Namespace)Part
The part to check for. - defaultValue (Optional)
- Type: SystemSingle
The value to return if no suitable colliders found. - filterFn (Optional)
- Type: SystemFuncCollider, Boolean
The filter function to apply to every collider. Return false from it to sklip the
collider in the following checks.
Return Value
Type:
Single
The square distance or
defaultValue if no colliders found.
RemarksThis method skips triggers and inactive colliders.
See Also