This commit is contained in:
CortexCore
2024-03-29 00:58:24 +08:00
parent 967ad8eacf
commit 05315ef4a8
232 changed files with 53368 additions and 8539 deletions

View File

@@ -90,6 +90,7 @@ namespace MagicaCloth2
public ExNativeArray<float3> oldPositions;
public ExNativeArray<quaternion> oldRotations;
/// <summary>
/// 有効なコライダーデータ数
/// </summary>
@@ -719,6 +720,7 @@ namespace MagicaCloth2
[Unity.Collections.ReadOnly]
public NativeArray<float3> transformScaleArray;
// コライダーごと
public void Execute(int index)
{
var flag = flagArray[index];
@@ -1094,7 +1096,6 @@ namespace MagicaCloth2
}
}
/// <summary>
/// シミュレーション更新後処理
/// </summary>

View File

@@ -540,7 +540,6 @@ namespace MagicaCloth2
[Unity.Collections.WriteOnly]
public NativeArray<float3> velocityPosArray;
public NativeArray<float3> dispPosArray;
[Unity.Collections.WriteOnly]
public NativeArray<float3> velocityArray;
public NativeArray<float3> realVelocityArray;
[Unity.Collections.WriteOnly]
@@ -607,6 +606,7 @@ namespace MagicaCloth2
dispPosArray[pindex] = MathUtility.ShiftPosition(dispPosArray[pindex], prevFrameWorldPosition, cdata.frameComponentShiftVector, cdata.frameComponentShiftRotation);
velocityArray[pindex] = math.mul(cdata.frameComponentShiftRotation, velocityArray[pindex]);
realVelocityArray[pindex] = math.mul(cdata.frameComponentShiftRotation, realVelocityArray[pindex]);
}
}
@@ -1168,6 +1168,7 @@ namespace MagicaCloth2
// 慣性の深さ影響
float inertiaDepth = param.inertiaConstraint.depthInertia * (1.0f - depth * depth); // 二次曲線
//Debug.Log($"[{pindex}] inertiaDepth:{inertiaDepth}");
inertiaVector = math.lerp(inertiaVector, cdata.stepVector, inertiaDepth);
inertiaRotation = math.slerp(inertiaRotation, cdata.stepRotation, inertiaDepth);
@@ -1393,6 +1394,8 @@ namespace MagicaCloth2
if (windMain < 0.01f)
return 0;
//Debug.Log($"windMain:{windMain}");
// 風速係数
float mainRatio = windMain / Define.System.WindBaseSpeed; // 0.0 ~
@@ -1855,8 +1858,6 @@ namespace MagicaCloth2
int vindex = tdata.proxyCommonChunk.startIndex + l_index;
var attr = attributes[vindex];
//if (attr.IsInvalid())
// return;
var pos = positions[vindex];
var rot = rotations[vindex];
@@ -1866,13 +1867,12 @@ namespace MagicaCloth2
// 移動パーティクル
var dpos = oldPosArray[pindex];
#if true
#if !MC2_DISABLE_FUTURE
// 未来予測
// 最終計算位置と実速度から次のステップ位置を予測し、その間のフレーム時間位置を表示位置とする
float3 velocity = realVelocityArray[pindex] * simulationDeltaTime;
float3 fpos = dpos + velocity;
float interval = (tdata.nowUpdateTime + simulationDeltaTime) - tdata.oldTime;
//float t = (tdata.time - tdata.oldTime) / interval;
float t = interval > 0.0f ? (tdata.time - tdata.oldTime) / interval : 0.0f;
fpos = math.lerp(dispPosArray[pindex], fpos, t);
dpos = fpos;

View File

@@ -147,7 +147,7 @@ namespace MagicaCloth2
sb.AppendLine($"MaxSimulationCountPerFrame:{maxSimulationCountPerFrame}");
sb.AppendLine($"GlobalTimeScale:{GlobalTimeScale}");
sb.AppendLine($"SimulationDeltaTime:{SimulationDeltaTime}");
sb.AppendLine($"MaxDeltaTime:{MaxDeltaTime}");
//sb.AppendLine($"MaxDeltaTime:{MaxDeltaTime}");
sb.AppendLine($"SimulationPower:{SimulationPower}");
}
sb.AppendLine();