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; }
public void Update() { float randomWindX = (Mathf.PerlinNoise(noiseCoord, 0) - 0.5f) * 2; float randomWindZ = (Mathf.PerlinNoise(0, noiseCoord) - 0.5f) * 2; noiseCoord += randomWindChangeRate * Time.deltaTime; sail.windVector = wind + new Vector3(randomWindX, 0, randomWindZ) * randomWindIntensity; sail.PushDataToSolver(new ObiSolverData(ObiSolverData.AerodynamicConstraintsData.WIND)); }