1
This commit is contained in:
@@ -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
|
||||
}
|
38
Unity/Extensions/Dreamteck/SplinePathProvider.cs
Normal file
38
Unity/Extensions/Dreamteck/SplinePathProvider.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user