09-04-2021, 11:28 AM
(This post was last modified: 09-04-2021, 11:30 AM by orestissar.)
(09-04-2021, 11:14 AM)josemendez Wrote: Cloth is made of particles, generally one per vertex. Each particle in the cloth has one skin constraint, that restricts its range of movement relative to the skinned mesh. If you don't iterate trough them all, you're setting values just for one of them.ok i understand now, tnx.
regarding the other thing:
my code is this:
Code:
public class CreateObiBP : MonoBehaviour
{
void Start()
{
GameObject CreateObi = this.gameObject;
Debug.Log("Loaded");
ObiSolver obs = CreateObi.AddComponent<ObiSolver>();
ObiLateFixedUpdater olfu = CreateObi.AddComponent<ObiLateFixedUpdater>();
olfu.solvers.Add(obs);
int garmentID = 0;
foreach (Transform child in CreateObi.transform)
{
GameObject childobject = child.gameObject;
var blueprint = ScriptableObject.CreateInstance<ObiSkinnedClothBlueprint>();
var bd = ScriptableObject.CreateInstance<ObiSkinnedClothBlueprint>();
SkinnedMeshRenderer skin = childobject.GetComponent(typeof(SkinnedMeshRenderer)) as SkinnedMeshRenderer;
var mesh = skin.sharedMesh;
blueprint.name = childobject.name;
blueprint.inputMesh = mesh;
blueprint.Generate();
ObiSkinnedCloth obsc = childobject.AddComponent<ObiSkinnedCloth>() as ObiSkinnedCloth;
obsc.skinnedClothBlueprint = blueprint;
ObiSkinnedClothRenderer obscr = childobject.AddComponent<ObiSkinnedClothRenderer>() as ObiSkinnedClothRenderer;
}
}