修复头尾抖,auto orient完全胜利

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-07-26 19:03:38 +08:00
parent b577cf7f8d
commit 428ca1d738
20 changed files with 120198 additions and 18641 deletions

View File

@@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -10
executionOrder: 3
icon: {fileID: 2800000, guid: 9bbaac8eb7021d44b9864113856c00fa, type: 3}
userData:
assetBundleName:

View File

@@ -1,11 +1,11 @@
fileFormatVersion: 2
guid: a212c074803b6824cae48ffa7abb84cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -40
icon: {fileID: 2800000, guid: 09a5be8542799294ab31f6b97c88471b, type: 3}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a212c074803b6824cae48ffa7abb84cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 8
icon: {fileID: 2800000, guid: 09a5be8542799294ab31f6b97c88471b, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,11 +1,11 @@
fileFormatVersion: 2
guid: 598e68924c9f6324bbfd049d3bae754c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -60
icon: {fileID: 2800000, guid: 3c4c2926f013fcf498c19b14b90050c5, type: 3}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 598e68924c9f6324bbfd049d3bae754c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 5
icon: {fileID: 2800000, guid: 3c4c2926f013fcf498c19b14b90050c5, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,11 +1,11 @@
fileFormatVersion: 2
guid: f3bc3656a791f444ca225a99f9333768
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -20
icon: {fileID: 2800000, guid: 5a7f65ad6116cff448644595264d0ae4, type: 3}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: f3bc3656a791f444ca225a99f9333768
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 9
icon: {fileID: 2800000, guid: 5a7f65ad6116cff448644595264d0ae4, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -44,7 +44,7 @@ namespace Dreamteck.Splines
if (Camera.current != null)
{
_orthographic = Camera.current.orthographic;
}
}
else if (Camera.main != null)
{
_orthographic = Camera.main.orthographic;
@@ -124,10 +124,12 @@ namespace Dreamteck.Splines
for (int i = 0; i < sampleCount; i++)
{
GetSample(i, ref evalResult);
// if (i == 0) evalResult.position = transform.position;
// else if (i == sampleCount - 1) evalResult.position = transform.position; // 或目标点
Vector3 center = evalResult.position;
if (hasOffset) center += offset.x * -Vector3.Cross(evalResult.forward, evalResult.up) + offset.y * evalResult.up + offset.z * evalResult.forward;
Vector3 vertexNormal;
if(orthoGraphic) vertexNormal = vertexDirection;
if (orthoGraphic) vertexNormal = vertexDirection;
else vertexNormal = (vertexDirection - center).normalized;
Vector3 vertexRight = Vector3.Cross(evalResult.forward, vertexNormal).normalized;
if (uvMode == UVMode.UniformClamp || uvMode == UVMode.UniformClip) AddUVDistance(i);

View File

@@ -1,6 +1,7 @@
using UnityEngine;
namespace Dreamteck.Splines {
namespace Dreamteck.Splines
{
[ExecuteInEditMode]
public class SplineUser : MonoBehaviour, ISerializationCallbackReceiver, ISampleModifier
{
@@ -10,7 +11,8 @@ namespace Dreamteck.Splines {
public SplineComputer spline
{
get {
get
{
return _spline;
}
set
@@ -104,7 +106,7 @@ namespace Dreamteck.Splines {
if (value != _loopSamples)
{
_loopSamples = value;
if(!_loopSamples && _clipTo < _clipFrom)
if (!_loopSamples && _clipTo < _clipFrom)
{
double temp = _clipTo;
_clipTo = _clipFrom;
@@ -218,7 +220,7 @@ namespace Dreamteck.Splines {
protected Transform trs
{
get { return _trs; }
get { return _trs; }
}
protected bool hasTransform
{
@@ -252,7 +254,8 @@ namespace Dreamteck.Splines {
}
#endif
protected virtual void Awake() {
protected virtual void Awake()
{
#if UNITY_EDITOR
_isPlaying = Application.isPlaying;
if (!_isPlaying)
@@ -272,7 +275,8 @@ namespace Dreamteck.Splines {
if (buildOnAwake && Application.isPlaying)
{
RebuildImmediate();
} else
}
else
{
GetSamples();
}
@@ -438,6 +442,8 @@ namespace Dreamteck.Splines {
/// <param name="sampleComputer">Should the SplineUser sample the SplineComputer</param>
public virtual void Rebuild()
{
_sampleCollection.Evaluate(clipFrom, ref _clipFromSample);
_sampleCollection.Evaluate(_clipTo, ref _clipToSample);
#if UNITY_EDITOR
if (!_hasTransform)
{
@@ -505,7 +511,7 @@ namespace Dreamteck.Splines {
LateRun();
}
#if UNITY_EDITOR
if(!_isPlaying && updateMethod == UpdateMethod.FixedUpdate)
if (!_isPlaying && updateMethod == UpdateMethod.FixedUpdate)
{
Run();
RunUpdate();
@@ -550,7 +556,7 @@ namespace Dreamteck.Splines {
{
PostBuild();
EmptySplineHandler postBuildHandler = onPostBuild;
if(postBuildHandler != null)
if (postBuildHandler != null)
{
postBuildHandler();
}
@@ -682,19 +688,22 @@ namespace Dreamteck.Splines {
if (_clipFrom != 0.0)
{
_sampleCollection.Evaluate(clipFrom, ref _clipFromSample);
} else
}
else
{
_clipFromSample = _sampleCollection.samples[0];
}
if(_clipTo != 1.0)
if (_clipTo != 1.0)
{
_sampleCollection.Evaluate(_clipTo, ref _clipToSample);
} else
}
else
{
_clipToSample = _sampleCollection.samples[_sampleCollection.length - 1];
}
int start, end;
_sampleCount = _sampleCollection.GetClippedSampleCount(_clipFrom, _clipTo, out start, out end);
double lerp;