修曲线
This commit is contained in:
Binary file not shown.
@@ -143,7 +143,7 @@
|
|||||||
<beamEndEffecterDef>GraserBeam_End</beamEndEffecterDef>
|
<beamEndEffecterDef>GraserBeam_End</beamEndEffecterDef>
|
||||||
<beamLineFleckDef>Fleck_Wula_Dark_Matter_Beam</beamLineFleckDef> <!-- Fallback for base verb properties -->
|
<beamLineFleckDef>Fleck_Wula_Dark_Matter_Beam</beamLineFleckDef> <!-- Fallback for base verb properties -->
|
||||||
<beamCurvature>0.5</beamCurvature> <!-- 让光束更弯曲一点 -->
|
<beamCurvature>0.5</beamCurvature> <!-- 让光束更弯曲一点 -->
|
||||||
<flecksPerCell>1.5</flecksPerCell>
|
<flecksPerCell>1</flecksPerCell>
|
||||||
|
|
||||||
<!-- Split Config -->
|
<!-- Split Config -->
|
||||||
<isSplit>true</isSplit>
|
<isSplit>true</isSplit>
|
||||||
|
|||||||
@@ -173,7 +173,12 @@ namespace ArachnaeSwarm
|
|||||||
// 1. Generate Bezier curve points
|
// 1. Generate Bezier curve points
|
||||||
int segments = Mathf.Max(3, Mathf.CeilToInt(magnitude * Props.flecksPerCell));
|
int segments = Mathf.Max(3, Mathf.CeilToInt(magnitude * Props.flecksPerCell));
|
||||||
|
|
||||||
Vector3 controlPoint = Vector3.Lerp(start, end, 0.5f) + new Vector3(0, -magnitude * Props.beamCurvature, 0);
|
// --- ULTIMATE CURVE FIX ---
|
||||||
|
// The control point must be offset perpendicular to the beam's direction on the XZ plane, not on the Y axis.
|
||||||
|
Vector3 direction = (end - start).normalized;
|
||||||
|
Vector3 perpendicular = new Vector3(-direction.z, 0, direction.x); // Rotated 90 degrees on the XZ plane.
|
||||||
|
|
||||||
|
Vector3 controlPoint = Vector3.Lerp(start, end, 0.5f) + perpendicular * magnitude * Props.beamCurvature;
|
||||||
var path = BezierUtil.GenerateQuadraticPoints(start, controlPoint, end, segments);
|
var path = BezierUtil.GenerateQuadraticPoints(start, controlPoint, end, segments);
|
||||||
// 2. Check if there are enough points to connect
|
// 2. Check if there are enough points to connect
|
||||||
if (path.Count < 2)
|
if (path.Count < 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user