// 物理演算でモデルの配置を更新 public void Run() { bulletPhysics.StepSimulation(); for (int i = 0; i < models.Count; ++i) { var rigid_world = bulletPhysics.GetWorld(bodies[i]); // 剛体のワールド変換行列 var model_world = model_world_from_rigid * rigid_world; // モデルのワールド変換行列 var v = model_world.get_Rows(3); models[i].Transformer.Position = new Vector3(v.X, v.Y, v.Z); models[i].Transformer.Rotation = Quaternion.RotationMatrix(model_world); } }
/// <summary> /// 物理演算でモデルの配置を更新 /// </summary> public void Run() { bulletPhysics.StepSimulation(); for (int i = 0; i < balls.Count; ++i) { Matrix rigid_world = bulletPhysics.GetWorld(balls[i]); // ball剛体のワールド変換行列 Matrix model_world = transferMatrixFromRigidToModel * rigid_world; // ballモデルのワールド変換行列 Vector4 v = model_world.get_Rows(3); models[1 + i].Transformer.Position = new Vector3(v.X, v.Y, v.Z); models[1 + i].Transformer.Rotation = Quaternion.RotationMatrix(model_world); } }
private void timer1_Tick(object sender, EventArgs e) { bulletPhysics.StepSimulation(); bulletPhysics.dynamicsWorld.ContactPairTest(ball, ball2, callBack); Matrix rigid_world = bulletPhysics.GetWorld(ball); Matrix model_world = rigid2model * rigid_world; Vector4 transLation = model_world.get_Rows(3); ball_Model.Transformer.Position = new Vector3(transLation.X, transLation.Y, transLation.Z); ball_Model.Transformer.Rotation = Quaternion.RotationMatrix(model_world); rigid_world = bulletPhysics.GetWorld(ball2); model_world = rigid2model * rigid_world; transLation = model_world.get_Rows(3); ball_Model2.Transformer.Position = new Vector3(transLation.X, transLation.Y, transLation.Z); ball_Model2.Transformer.Rotation = Quaternion.RotationMatrix(model_world); }
public void Run() { bulletPhysics.StepSimulation(); }