15-06-2020, 05:59 PM
(15-06-2020, 05:16 PM)josemendez Wrote: Hi,
There was a bug related to this, fixed in 5.2.
open up Obi/Scripts/Cloth/Actors/ObiSkinnedCloth.cs, and replace the SetTargetSkin method with the following one. That should allow multiple skinned cloth actors to be rendered correctly.
Code:private void SetTargetSkin()
{
using (m_SetTargetSkinPerfMarker.Auto())
{
var skinConstraints = GetConstraintsByType(Oni.ConstraintType.Skin) as ObiConstraints<ObiSkinConstraintsBatch>;
var batch = skinConstraints.batches[0] as ObiSkinConstraintsBatch;
using (m_SortSkinInputsPerfMarker.Auto())
{
int pointCount = bakedVertices.Count;
for (int i = 0; i < pointCount; ++i)
{
int welded = m_SkinnedClothBlueprint.topology.rawToWelded[i];
sortedPoints[welded] = bakedVertices[i];
sortedNormals[welded] = bakedNormals[i];
}
}
using (m_SetSkinInputsPerfMarker.Auto())
{
Matrix4x4 skinToSolver = actorLocalToSolverMatrix;
for (int i = 0; i < batch.activeConstraintCount; ++i)
{
int solverIndex = batch.particleIndices[i];
int actorIndex = solver.particleToActor[solverIndex].indexInActor;
batch.skinPoints[i] = skinToSolver.MultiplyPoint3x4(sortedPoints[actorIndex]);
batch.skinNormals[i] = skinToSolver.MultiplyVector(sortedNormals[actorIndex]);
// Rigidly transform particles with zero skin radius and zero compliance:
if (Mathf.Approximately(batch.skinRadiiBackstop[i * 3], 0) & Mathf.Approximately(batch.skinCompliance[i], 0))
{
solver.invMasses[solverIndex] = 0;
solver.positions[solverIndex] = batch.skinPoints[i];
}
}
}
}
}
Hi
Ok will try that
