本文整理汇总了C#中System.Vector3.Clamp方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.Clamp方法的具体用法?C# Vector3.Clamp怎么用?C# Vector3.Clamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector3
的用法示例。
在下文中一共展示了Vector3.Clamp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NearestPointTo
/// <summary>Get the nearest point between this <see cref="Box3"/> and a <see cref="Vector3"/>. If the <see cref="Vector3"/> is inside this <see cref="Box3"/>, it is returned untouched.</summary>
public void NearestPointTo( ref Vector3 point , out Vector3 result)
{
Containment containment = Intersect(ref point);
if(containment != Containment.Disjoint)
result = point;
else
point.Clamp(ref Min, ref Max, out result);
return;
}
示例2: ClosestPoint
/// <summary>
/// Finds the closest point on a bounding box from another point
/// </summary>
/// <param name="box"></param>
/// <param name="point"></param>
/// <returns></returns>
public static Vector3 ClosestPoint(this BoundingBox box, Vector3 point)
{
return point.Clamp(box.Min, box.Max);
}
示例3: Clamp
public static Vector3 Clamp(Vector3 v1, float min, float max)
{
v1.Clamp(min, max); return v1;
}