Click or drag to resize

Colliders.GetSqrDistanceToPart 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+
Syntax
C#
public static Nullable<float> GetSqrDistanceToPart(
	Vector3 point,
	Part part,
	Func<Collider, bool> filterFn = null
)
Request Example View Source

Parameters

point
Type: UnityEngine.Vector3
The reference point to find distance for.
part
Type: (Default Namespace).Part
The part to check for.
filterFn (Optional)
Type: System.Func<Collider, Boolean>
The filter function to apply to every collider. Return false from it to sklip the collider in the following checks.

Return Value

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