コード例 #1
0
        void Init_ClusterRobot()
        {
            Vector3       basePos = new Vector3(0, 25, 8);
            SoftBody      psb0    = Init_ClusterRobot_CreateBall(basePos + new Vector3(-8, 0, 0));
            SoftBody      psb1    = Init_ClusterRobot_CreateBall(basePos + new Vector3(+8, 0, 0));
            SoftBody      psb2    = Init_ClusterRobot_CreateBall(basePos + new Vector3(0, 0, +8 * (float)Math.Sqrt(2)));
            Vector3       ctr     = (psb0.ClusterCom(0) + psb1.ClusterCom(0) + psb2.ClusterCom(0)) / 3;
            CylinderShape pshp    = new CylinderShape(new Vector3(8, 1, 8));
            RigidBody     prb     = LocalCreateRigidBody(50, Matrix.Translation(ctr + new Vector3(0, 5, 0)), pshp);

            LJoint.Specs ls = new LJoint.Specs();
            ls.Erp = 0.5f;
            Body prbBody = new Body(prb);

            ls.Position = psb0.ClusterCom(0); psb0.AppendLinearJoint(ls, prbBody);
            ls.Position = psb1.ClusterCom(0); psb1.AppendLinearJoint(ls, prbBody);
            ls.Position = psb2.ClusterCom(0); psb2.AppendLinearJoint(ls, prbBody);

            BoxShape  pbox = new BoxShape(20, 1, 40);
            RigidBody pgrn = LocalCreateRigidBody(0, Matrix.RotationZ(-(float)Math.PI / 4), pbox);
        }