本文整理汇总了C#中UnityEngine.Vector3.Project方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.Project方法的具体用法?C# Vector3.Project怎么用?C# Vector3.Project使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Vector3
的用法示例。
在下文中一共展示了Vector3.Project方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: distance
/// <summary>
/// Calculate the distance between two point's projections on a plane.
/// </summary>
/// <param name="v"></param>
/// <param name="u"></param>
/// <param name="planePos">An arbitrary point inside the plane.</param>
/// <param name="planeRot">The plane's rotation.</param>
/// <returns>The distance of both points' projection in the plane.</returns>
public static float distance(this Vector3 v, Vector3 u, Vector3 planePos, Quaternion planeRot)
{
var localv = v.Project( planePos, planeRot );
var localu = u.Project( planePos, planeRot );
return localv.distance( localu );
}
示例2: sqrDistance
/// <summary>
/// Calculate the squared distance between two points' projections on an arbitrary plane.
/// </summary>
/// <param name="v"></param>
/// <param name="normal">Normal defining the plane to project on.</param>
/// <returns>The squared distance between the two points on the plane.</returns>
public static float sqrDistance(this Vector3 v, Vector3 u, Vector3 normal)
{
var localv = v.Project( normal );
var localu = u.Project( normal );
return localv.distance( localu );
}