//// 玉を作る //void CreateSphereRigid() { // const float mass = 1.0f; // const float restitution = 0.8f; // const float friction = 0.5f; // const float linear_damp = 0.15f; // const float angular_damp = 0.15f; // var world = Matrix.Translation(0, height, 0); // sphere = bulletPhysics.CreateSphere(radius, world, mass, restitution, friction, linear_damp, angular_damp); //} // 角棒を作る void CreateBarRigid() { const float depth = 5.0f; const float mass = 1.0f; const float restitution = 0.75f; const float friction = 0.5f; const float linear_damp = 0.30f; const float angular_damp = 0.30f; var trans = Matrix.Translation(0, height, 0); var rotation = Matrix.RotationZ(-(float)Math.PI / 3); var world = rotation * trans; bar = bulletPhysics.CreateBox(bar_width, bar_height, depth, world, mass, restitution, friction, linear_damp, angular_damp); }
// 土台を作る void CreateBoxRigid() { const float width = 150, height = 0.5f, depth = 150; const float mass = 0; const float restitution = 1.0f; var world = Matrix.Translation(0, -height, 0); // 上面がy = 0になるように置く ground = bulletPhysics.CreateBox(width, height, depth, world, mass, restitution); }
// ビリヤード台の剛体を作る private void CreateBilliardRigids(MMDModel model) { foreach (RigidBodyData rigidBody in model.Model.RigidBodyList.RigidBodies) { Matrix trans = Matrix.Translation(rigidBody.Position); Matrix rot = Matrix.RotationYawPitchRoll(rigidBody.Rotation[1], rigidBody.Rotation[0], rigidBody.Rotation[2]); bulletPhysics.CreateBox(rigidBody.Size.X, rigidBody.Size.Y, rigidBody.Size.Z, rot * trans, 0, 1, 0, 0, 0); } models[0].Transformer.Position = new Vector3(0, 0, 0); models[0].Transformer.Rotation = Quaternion.Identity; }