修复已知的Spline错误

This commit is contained in:
2025-12-19 11:17:18 +08:00
parent b455d2572b
commit fd42a868d8
2 changed files with 15 additions and 5 deletions

View File

@@ -51,6 +51,7 @@ namespace Demo.Game
} }
private Node m_MyNode; private Node m_MyNode;
public bool IsSetupNodeSize = false;
public float NodeSize = 1; public float NodeSize = 1;
public Color NodeColor = Color.white; public Color NodeColor = Color.white;
public bool IsSetupNodeRotation = false; public bool IsSetupNodeRotation = false;
@@ -62,9 +63,18 @@ namespace Demo.Game
public void AddTo(SplineCore core) public void AddTo(SplineCore core)
{ {
int MyNodeContent = core.NodeContent; int MyNodeContent = core.NodeContent;
core.MySplineComputer.SetPointColor(MyNodeContent, NodeColor); MyNode.transformSize = !IsSetupNodeSize;
core.MySplineComputer.SetPointSize(MyNodeContent, NodeSize); core.MySplineComputer.SetPointSize(MyNodeContent, NodeSize);
core.MySplineComputer.SetPointNormal(MyNodeContent, IsSetupNodeRotation ? NodeRotation.normalized : transform.up); if (IsSetupNodeRotation)
{
MyNode.transformNormals = false;
core.MySplineComputer.SetPointNormal(MyNodeContent, NodeRotation.normalized);
}
else
{
core.MySplineComputer.SetPointNormal(MyNodeContent, transform.up);
}
core.MySplineComputer.SetPointColor(MyNodeContent, NodeColor);
MyNode.AddConnection(core.MySplineComputer, MyNodeContent); MyNode.AddConnection(core.MySplineComputer, MyNodeContent);
} }
@@ -75,7 +85,7 @@ namespace Demo.Game
[Convention.RScript.Variable.Attr.Method] [Convention.RScript.Variable.Attr.Method]
public void SetNodeSize(float size) public void SetNodeSize(float size)
{ {
SetLocalScaling(size, size, size); IsSetupNodeSize = true;
NodeSize = size; NodeSize = size;
} }
@@ -102,7 +112,7 @@ namespace Demo.Game
public void SetNodeRotation(float x, float y, float z) public void SetNodeRotation(float x, float y, float z)
{ {
IsSetupNodeRotation = true; IsSetupNodeRotation = true;
this.transform.localEulerAngles = NodeRotation = new(x, y, z); NodeRotation = new(x, y, z);
} }
} }
} }