protected void SetConfig(SoftBody sb) { sb.Cfg.AeroModel = this.AeroModel; sb.Cfg.DF = this.DynamicFrictionCoefficient; sb.Cfg.DP = this.DampingCoefficient; sb.Cfg.PR = this.PressureCoefficient; sb.Cfg.LF = this.LiftCoefficient; sb.Cfg.VC = this.VolumeConservation; sb.Cfg.Collisions |= FCollisions.VFSS; sb.Cfg.Chr = this.RigidContactHardness; sb.Cfg.Shr = this.SoftContactHardness; sb.Cfg.DG = this.DragCoefficient; sb.Cfg.Ahr = this.AnchorHardness; if (this.IsVolumeMass) { sb.SetVolumeMass(this.Mass); } else { sb.SetTotalMass(this.Mass, false); } if (this.GenerateBendingConstraints) { sb.GenerateBendingConstraints(this.BendingDistance); } }
void InitTetraCube() { string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath); SoftBody psb = SoftBodyHelpers.CreateFromTetGenFile(softBodyWorldInfo, path + "\\data\\cube.ele", null, path + "\\data\\cube.node", false, true, true); SoftWorld.AddSoftBody(psb); psb.Scale(new Vector3(4, 4, 4)); psb.Translate(0, 5, 0); psb.SetVolumeMass(300); // fix one vertex //psb.SetMass(0,0); //psb.SetMass(10,0); //psb.SetMass(20,0); psb.Cfg.PIterations = 1; //psb.GenerateClusters(128); psb.GenerateClusters(16); //psb.CollisionShape.Margin = 0.5f; psb.CollisionShape.Margin = 0.01f; psb.Cfg.Collisions = FCollisions.CLSS | FCollisions.CLRS; // | FCollisions.CLSelf; psb.Materials[0].Lst = 0.8f; cutting = false; CullingEnabled = false; }
void Init_TetraBunny() { SoftBody psb = SoftBodyHelpers.CreateFromTetGenData(softBodyWorldInfo, Bunny.GetElements(), null, Bunny.GetNodes(), false, true, true); SoftWorld.AddSoftBody(psb); psb.Rotate(Quaternion.RotationYawPitchRoll((float)Math.PI / 2, 0, 0)); psb.SetVolumeMass(150); psb.Cfg.PIterations = 2; //psb.Cfg.PIterations = 1; cutting = false; //psb.CollisionShape.Margin = 0.01f; psb.Cfg.Collisions = FCollisions.CLSS | FCollisions.CLRS; //| FCollisions.CLSelf; ///pass zero in generateClusters to create cluster for each tetrahedron or triangle psb.GenerateClusters(0); //psb.Materials[0].Lst = 0.2f; psb.Cfg.DF = 10; }