void initialize_cloth_property()
    {
        // bending constraints
        // cancel some constraints
        ObiTetherConstraints tether = this.GetComponent <ObiTetherConstraints>();

        tether.enabled = false;
        tether.PushDataToSolver();
        ObiSkinConstraints skin = this.GetComponent <ObiSkinConstraints>();

        skin.enabled = false;
        skin.PushDataToSolver();
        ObiVolumeConstraints volume = this.GetComponent <ObiVolumeConstraints>();

        volume.enabled = false;
        volume.PushDataToSolver();
        ObiAerodynamicConstraints aero = this.GetComponent <ObiAerodynamicConstraints>();

        aero.enabled = false;
        aero.PushDataToSolver();
        ObiCloth tmp = this.GetComponent <ObiCloth>();

        tmp.SelfCollisions    = true;
        tmp.CollisionMaterial = Resources.Load("collision_material/MediumFriction") as ObiCollisionMaterial;
        tmp.PushDataToSolver();


        //tmp.runInEditMode = true;  won't destroy after playing
        //unfix particle
        //for (int i = 0; i < tmp.invMasses.Length; i++)
        //     tmp.invMasses[i]= 0;
    }
示例#2
0
    void initialize_cloth_property()
    {
        // bending constraints
        ObiBendingConstraints bend = this.GetComponent <ObiBendingConstraints>();

        bend.maxBending = 0.008f;
        bend.stiffness  = 0.8f;   //general parameters
        // cancel some constraints
        ObiTetherConstraints tether = this.GetComponent <ObiTetherConstraints>();

        tether.enabled = false;
        ObiSkinConstraints skin = this.GetComponent <ObiSkinConstraints>();

        skin.enabled = false;
        ObiVolumeConstraints volume = this.GetComponent <ObiVolumeConstraints>();

        volume.enabled = false;
        ObiAerodynamicConstraints aero = this.GetComponent <ObiAerodynamicConstraints>();

        aero.enabled = false;

        ObiCloth tmp = this.GetComponent <ObiCloth>();

        tmp.SelfCollisions    = true;
        tmp.CollisionMaterial = Resources.Load("collision_material/LowFriction") as ObiCollisionMaterial;


        //tmp.runInEditMode = true;  won't destroy after playing
        //unfix particle
        //for (int i = 0; i < tmp.invMasses.Length; i++)
        //     tmp.invMasses[i]= 0;
    }
 public void OnEnable()
 {
     constraints = (ObiSkinConstraints)target;
 }