绳子修改
This commit is contained in:
@@ -9,7 +9,7 @@ namespace NBF
|
||||
public static class PointsExtensions
|
||||
{
|
||||
// Curve length
|
||||
public static float GetLengthOfCurve(this NativeArray<float3> curve, ref float4x4 transform, bool isLoop = false)
|
||||
public static float GetLengthOfCurve(this NativeArray<float3> curve, ref float4x4 transform)
|
||||
{
|
||||
if (curve == null || curve.Length == 0)
|
||||
{
|
||||
@@ -24,31 +24,28 @@ namespace NBF
|
||||
sum += math.distance(lastPoint, point);
|
||||
lastPoint = point;
|
||||
}
|
||||
if (isLoop)
|
||||
{
|
||||
sum += math.distance(lastPoint, firstPoint);
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
public static float GetLengthOfCurve(this NativeArray<float3> curve, bool isLoop = false)
|
||||
public static float GetLengthOfCurve(this NativeArray<float3> curve)
|
||||
{
|
||||
var transform = float4x4.identity;
|
||||
return curve.GetLengthOfCurve(ref transform, isLoop);
|
||||
return curve.GetLengthOfCurve(ref transform);
|
||||
}
|
||||
|
||||
public static float GetLengthOfCurve(this IEnumerable<float3> curve, ref float4x4 transform, bool isLoop = false)
|
||||
public static float GetLengthOfCurve(this IEnumerable<float3> curve, ref float4x4 transform)
|
||||
{
|
||||
var array = new NativeArray<float3>(curve.ToArray(), Allocator.Temp);
|
||||
var sum = array.GetLengthOfCurve(ref transform, isLoop);
|
||||
var sum = array.GetLengthOfCurve(ref transform);
|
||||
array.Dispose();
|
||||
return sum;
|
||||
}
|
||||
|
||||
public static float GetLengthOfCurve(this IEnumerable<float3> curve, bool isLoop = false)
|
||||
public static float GetLengthOfCurve(this IEnumerable<float3> curve)
|
||||
{
|
||||
var transform = float4x4.identity;
|
||||
return curve.GetLengthOfCurve(ref transform, isLoop);
|
||||
return curve.GetLengthOfCurve(ref transform);
|
||||
}
|
||||
|
||||
// Curve points
|
||||
|
||||
Reference in New Issue
Block a user