Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Set Cloth Properties with script
#5
(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;
         
        }

    }
everything in the scene seems to generate, however i still get the error
Reply


Messages In This Thread
Set Cloth Properties with script - by orestissar - 08-04-2021, 02:33 PM
RE: Set Cloth Properties with script - by orestissar - 09-04-2021, 11:28 AM