Click or drag to resize

CollidersGetSqrDistanceToPartOrDefault Method

Returns the minimum square distance to the nearest point on the part's collider surface.

Namespace:  KSPDev.ModelUtils
Assembly:  KSPDev_Utils.2.5 (in KSPDev_Utils.2.5.dll) Version: 2.5 for KSP v1
Syntax
C#
public static float GetSqrDistanceToPartOrDefault(
	Vector3 point,
	Part part,
	float defaultValue = ∞f,
	Func<Collider, bool> filterFn = null
)
Request Example View Source

Parameters

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 skip the collider in the following checks.

Return Value

Type: Single
The square distance or defaultValue if no colliders found.
Remarks
This method skips triggers and inactive colliders.
See Also