このHTMLドキュメントは、書籍「リアルな動きのための ゲーム物理プログラミング」(ISBN:978-4-8399-3163-6)のサンプルについて説明し ています。
各サンプルのソリューションファイル(.sln)やプロジェクトファイル(.csproj)は以下の場所に収録しています。
| 対応する章や節 | サンプルのフォルダやファイル | 概要 |
|---|---|---|
| 2.2.1 | Farseer Physics 2.1.1 XNA\FarseerPhysicsXNA.sln | サンプルで参照しているオープンソースの物理エンジンライブラリ「Farseer Engine Physics 2.1.1」 |
| 2.2.2 | JigLibX\JigLibX\JigLibX.csproj | サンプルで参照しているオープンソースの物理エンジンライブラリ「JigLibX 0.3.1」のプロジェクト |
| 3.1.4 | FarseerPhysicsTutorial1\FarseerPhysicsTutorial.sln | Farseer Engine Physicsのチュートリアル1 |
| 3.1.5 | FarseerPhysicsTutorial2\FarseerPhysicsTutorial2.sln | Farseer Engine Physicsのチュートリアル2 |
| 3.2.4 | JigLibXTutorial\JigLibXTutorial1.sln | JigLibXのチュートリアル1 |
| 3.2.6 | JigLibXTutorial\JigLibXTutorial2.sln | JigLibXのチュートリアル2 |
| 3.2.10 | JigLibXTutorial\JigLibXTutorial3.sln | JigLibXのチュートリアル3 |
| 3.2.11 | JigLibXTutorial\JigLibXTutorial4.sln | JigLibXのチュートリアル4 |
| 3.2.12 | JigLibXTutorial\JigLibXTutorial5.sln | JigLibXのチュートリアル5 |
| 4 | MathSamples\MathSamples.sln | 数学ライブラリのサンプル(4章の各プロジェクトを含む) |
| 4.2 | MathSamples\MathSample1\MathSample1.csproj | ベクトルのサンプルプロジェクト |
| 4.3 | MathSamples\MathSample2\MathSample2.csproj | 行列のサンプルプロジェクト |
| 4.4 | MathSamples\MathSample3\MathSample3.csproj | クォータニオンのサンプルプロジェクト |
| 4.5 | MathSamples\MathSample4\MathSample4.csproj | デュアルクォータニオンのサンプルプロジェクト |
| 4 | XELF.Framework\XELF.Framework.csproj | 数学ライブラリのプロジェクト(単体/Windows用) |
| 4 | XELF.Framework\XELF.Xna.csproj | 数学ライブラリのプロジェクト(XNA/Windows用) |
| 4 | XELF.Framework\XELF.Xna.Xbox.csproj | 数学ライブラリのプロジェクト(XNA/Xbox 360用) |
| 5.1 | RigidBody\RigidBody.sln | 剛体運動のサンプル |
| 6.1 | Sphynx\Sphynx.sln | Farsser Physics Engineによる物理を用いた2Dゲーム「Sphynx」 |
| 7.1 | Hair.JigLibX\Hair.JigLibX.sln | JigLibXによる「髪の毛」の表現 |
| 8.3 | Cloth1.StillDesign\Cloth1.sln | PhysXによる「なびく布」の表現 |
| 8.3 | Cloth2.eyecm\Cloth2.sln | PhysXによる「服と胴」の表現 |
以下のオープンソースのソースコードは、以下の各ライセンスに基づいて収録しています 。必要に応じて各ライブラリの公式サイトにて提供される最新版をお使いください。
また、ソースコードを収録していないものついては、DLLの参照でビルドするように設定しています。必要に応じて、該当ライブラリの公式サイトにて提供されるソースコードや最新版DLLをお使いください。
| 物理エンジンライブラリ名 | 該当するライセンス |
|---|---|
| Farseer Physics Engine 2.1.1 | Microsoft Permissive License (Ms-PL) v1.1 |
| JigLibX 0.3.1 | Microsoft Public License (Ms-PL) |
「Cloth1」サンプルでは、XNA Game Studio 3.1対応するバージョンの「StillDesign.PhysX.Net」のDLLを作成して使っています。「StillDesign.PhysX.Net」のDLLをソースコードからビルドする場合には、ソリューション構成に「Release XNA 3.1」(デバッグ用は「Debug XNA 3.1」)のある最近のものをレポジトリからチェックアウトしてご利用ください。
また、サンプル「Cloth1」では、本書執筆時点よりも新しい「StillDesign.PhysX.Net」のバージョンを使うように変更しました。そのため、本書270ページの「ClothGame1.cs」の
// 物理演算されたメッシュのデータを受け取るバッファの設定
clothDescription.MeshData.AllocatePositions<vector3>(mesh.Points.Length);
clothDescription.MeshData.AllocateIndices<int>(mesh.Indices.Length);
clothDescription.MeshData.MaximumVertices = mesh.Points.Length;
clothDescription.MeshData.MaximumIndices = mesh.Indices.Length;
の部分を次のように、新たな処理を加えています。
// 物理演算されたメッシュのデータを受け取るバッファの設定
clothDescription.MeshData.AllocatePositions<vector3>(mesh.Points.Length);
clothDescription.MeshData.AllocateIndices<int>(mesh.Indices.Length);
clothDescription.MeshData.MaximumVertices = mesh.Points.Length;
clothDescription.MeshData.MaximumIndices = mesh.Indices.Length;
// (StillDesign.PhysX.Netの新バージョンに対応するための追加の処理)
clothDescription.MeshData.NumberOfVertices = mesh.Points.Length;
clothDescription.MeshData.NumberOfIndices = mesh.Indices.Length;
ダウンロード可能なプログラムコードの使用により発生したいかなる損失や損害、その他いかなる事態についても、弊社および著作権者、各ソフトウェアの製作・提供 者は責任を負いかねます。