This commit is contained in:
CortexCore
2023-06-05 16:25:06 +08:00
parent 9027120bb8
commit 4565ff2e35
2947 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
{
"name": "BITKit.Extensions.Dreamteck",
"rootNamespace": "",
"references": [
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
"GUID:7e67c9a4b0b46654ca8966b4e75013b5"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [
"DREAMTECK_SPLINES"
],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Dreamteck.Splines;
namespace BITKit
{
public class SplinePathProvider : LineObstacleProvider
{
public SplineComputer computer;
public SplinePositioner positioner;
public override bool IsValid(ref Vector3 startPos)
{
var isValid = base.IsValid(ref startPos);
if (isValid)
{
computer.SetPoint(0, new SplinePoint()
{
position = startPos,
tangent = startPos,
tangent2 = startPos,
});
computer.SetPoint(1, new SplinePoint()
{
position = endPos,
tangent = endPos + transform.rotation * new Vector3(0, 1, -1),
tangent2 = endPos + transform.rotation * new Vector3(0, 1, 1),
normal = new(0, 1, 0),
});
computer.RebuildImmediate();
}
return isValid;
}
public override Vector3 Evaluate(float time)
{
return positioner.EvaluatePosition(time);
}
}
}