using UnityEngine; public class DistanceToPoint : MonoBehaviour { public Transform planeTransform; public Vector3 point; void Start() { Plane plane = new Plane(planeTransform.up, planeTransform.position); float distance = plane.GetDistanceToPoint(point); Debug.Log("Distance from point to plane: " + distance); } }
using UnityEngine; public class DistanceToAllPlanes : MonoBehaviour { public Transform[] planes; public Vector3 point; void Start() { foreach (Transform planeTransform in planes) { Plane plane = new Plane(planeTransform.up, planeTransform.position); float distance = plane.GetDistanceToPoint(point); Debug.Log("Distance from point to plane: " + distance); } } }In this example, we iterate through an array of plane transforms and calculate the distance between a specified point and each of the planes using the GetDistanceToPoint method. Package Library: The UnityEngine library is part of the Unity game engine.