SoftBody Init_ClusterRobot_CreateBall(Vector3 pos) { SoftBody psb = SoftBodyHelpers.CreateEllipsoid(softBodyWorldInfo, pos, new Vector3(1, 1, 1) * 3, 512); psb.Materials[0].Lst = 0.45f; psb.Cfg.VC = 20; psb.SetTotalMass(50, true); psb.SetPose(true, false); psb.GenerateClusters(1); SoftWorld.AddSoftBody(psb); return(psb); }
void InitBunnyMatch() { SoftBody psb = SoftBodyHelpers.CreateFromTriMesh(softBodyWorldInfo, BunnyMesh.Vertices, BunnyMesh.Indices); psb.Cfg.DF = 0.5f; psb.Cfg.MT = 0.05f; psb.Cfg.PIterations = 5; psb.RandomizeConstraints(); psb.Scale(new Vector3(6, 6, 6)); psb.SetTotalMass(100, true); psb.SetPose(false, true); SoftWorld.AddSoftBody(psb); }
void InitVolume() { SoftBody psb = SoftBodyHelpers.CreateEllipsoid(softBodyWorldInfo, new Vector3(35, 25, 0), new Vector3(1, 1, 1) * 3, 512); psb.Materials[0].Lst = 0.45f; psb.Cfg.VC = 20; psb.SetTotalMass(50, true); psb.SetPose(true, false); SoftWorld.AddSoftBody(psb); CreateBigPlate(); CreateStairs(10, Vector3.Zero, new Vector3(2, 1, 5)); }
void InitTorusMatch() { SoftBody psb = SoftBodyHelpers.CreateFromTriMesh(softBodyWorldInfo, TorusMesh.Vertices, TorusMesh.Indices); psb.Materials[0].Lst = 0.1f; psb.Cfg.MT = 0.05f; psb.RandomizeConstraints(); Matrix m = Matrix.RotationYawPitchRoll(0, (float)Math.PI / 2, 0) * Matrix.Translation(0, 4, 0); psb.Transform(m); psb.Scale(new Vector3(2, 2, 2)); psb.SetTotalMass(50, true); psb.SetPose(false, true); SoftWorld.AddSoftBody(psb); }
/// <summary> /// Apply these SoftBody settings to this SoftBody /// </summary> /// <param name="softBody"></param> public void ConfigureSoftBody(SoftBody softBody) { softBody.Scale(scale.ToBullet()); BulletSharp.SoftBody.Material pm = softBody.Materials[0]; sBMaterial.SetSBMaterial(pm); config.CopyToBulletSBConfig(softBody.Cfg); if (allNodeBendingConstraints) { for (int i = 0; i < softBody.Nodes.Count - 1; ++i) { softBody.GenerateBendingConstraints(1 + i); } } else { softBody.GenerateBendingConstraints(bendingConstraintDistance, pm); } if (randomizeConstraints) { softBody.RandomizeConstraints(); } if (generateClusters) { softBody.GenerateClusters(0); } softBody.SetTotalMass(totalMass, fromFaces); softBody.SetPose(bvolume, bframe); }