diff options
author | chai <chaifix@163.com> | 2018-09-05 08:01:32 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-09-05 08:01:32 +0800 |
commit | 1db41995703f17069c27f9eebefda4c6858782ec (patch) | |
tree | 7df6124a1c0ed0d360f8b8423133b9745ffbaec5 | |
parent | 9c8f80daa67b98dfa603329f29fa4fc2ddfc8403 (diff) |
*update
21 files changed, 153 insertions, 22 deletions
diff --git a/Box2d/Assets/Program/Box2d/Box2d.cs b/Box2d/Assets/Program/Box2d/Box2d.cs index 308a02a..48acd74 100644 --- a/Box2d/Assets/Program/Box2d/Box2d.cs +++ b/Box2d/Assets/Program/Box2d/Box2d.cs @@ -1,10 +1,10 @@ using System.Collections; using System.Collections.Generic; -namespace Box2d +namespace Box2D { /////////////////////////////////// - // Box2d C# port + // Box2D C# port // author: chai /////////////////////////////////// } diff --git a/Box2d/Assets/Program/Box2d/Collision/Collision.cs b/Box2d/Assets/Program/Box2d/Collision/Collision.cs index 5b8a47a..85ae672 100644 --- a/Box2d/Assets/Program/Box2d/Collision/Collision.cs +++ b/Box2d/Assets/Program/Box2d/Collision/Collision.cs @@ -1,7 +1,7 @@ using System.Collections; using System.Collections.Generic; -namespace Box2d +namespace Box2D { } diff --git a/Box2d/Assets/Program/Box2d/Collision/Shapes/PolygonShape.cs b/Box2d/Assets/Program/Box2d/Collision/Shapes/PolygonShape.cs index 5b8a47a..85ae672 100644 --- a/Box2d/Assets/Program/Box2d/Collision/Shapes/PolygonShape.cs +++ b/Box2d/Assets/Program/Box2d/Collision/Shapes/PolygonShape.cs @@ -1,7 +1,7 @@ using System.Collections; using System.Collections.Generic; -namespace Box2d +namespace Box2D { } diff --git a/Box2d/Assets/Program/Box2d/Common/Mat22.cs b/Box2d/Assets/Program/Box2d/Common/Mat22.cs index 0da59dd..01ef830 100644 --- a/Box2d/Assets/Program/Box2d/Common/Mat22.cs +++ b/Box2d/Assets/Program/Box2d/Common/Mat22.cs @@ -1,6 +1,6 @@ using System; -namespace Box2d +namespace Box2D { class Mat22 { @@ -64,9 +64,27 @@ namespace Box2d return m; } - public Vec2 Solve() + public Vec2 Solve(float bx, float by) { + float a11 = col1.x; + float a12 = col2.x; + float a21 = col1.y; + float a22 = col2.y; + float det = a11 * a22 - a12 * a21; + if(det != 0.0) + { + det = 1 / det; + } + Vec2 v = new Vec2(); + v.x = det * (a22 * bx - a12 * by); + v.y = det * (a11 * by - a21 * bx); + return v; + } + public void Abs() + { + col1.Abs(); + col2.Abs(); } /* diff --git a/Box2d/Assets/Program/Box2d/Common/Mat22.cs.meta b/Box2d/Assets/Program/Box2d/Common/Mat22.cs.meta new file mode 100644 index 0000000..a0d6b7f --- /dev/null +++ b/Box2d/Assets/Program/Box2d/Common/Mat22.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 58cd4b32dd561184ca15f26c01a369c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Box2d/Assets/Program/Box2d/Common/Mat33.cs b/Box2d/Assets/Program/Box2d/Common/Mat33.cs new file mode 100644 index 0000000..13f5205 --- /dev/null +++ b/Box2d/Assets/Program/Box2d/Common/Mat33.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Assets.Program.Box2D.Common +{ + class Mat33 + { + } +} diff --git a/Box2d/Assets/Program/Box2d/Common/Mat33.cs.meta b/Box2d/Assets/Program/Box2d/Common/Mat33.cs.meta new file mode 100644 index 0000000..4ecec26 --- /dev/null +++ b/Box2d/Assets/Program/Box2d/Common/Mat33.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 06591de91aac2114e847959b0f58fca4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Box2d/Assets/Program/Box2d/Common/Math.cs b/Box2d/Assets/Program/Box2d/Common/Math.cs index aece85a..d3a5afc 100644 --- a/Box2d/Assets/Program/Box2d/Common/Math.cs +++ b/Box2d/Assets/Program/Box2d/Common/Math.cs @@ -1,6 +1,6 @@ using System; -namespace Box2d +namespace Box2D { /// <summary> diff --git a/Box2d/Assets/Program/Box2d/Common/Math.cs.meta b/Box2d/Assets/Program/Box2d/Common/Math.cs.meta new file mode 100644 index 0000000..088ae1e --- /dev/null +++ b/Box2d/Assets/Program/Box2d/Common/Math.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 879d076e184cb3e4e80bc0d6fe3aaa62 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Box2d/Assets/Program/Box2d/Common/Sweep.cs b/Box2d/Assets/Program/Box2d/Common/Sweep.cs new file mode 100644 index 0000000..ba1fd07 --- /dev/null +++ b/Box2d/Assets/Program/Box2d/Common/Sweep.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Assets.Program.Box2D.Common +{ + class Sweep + { + } +} diff --git a/Box2d/Assets/Program/Box2d/Common/Sweep.cs.meta b/Box2d/Assets/Program/Box2d/Common/Sweep.cs.meta new file mode 100644 index 0000000..bd4e196 --- /dev/null +++ b/Box2d/Assets/Program/Box2d/Common/Sweep.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4fc4cbe4f3c3dc94a9bf5bc923123647 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Box2d/Assets/Program/Box2d/Common/Transform.cs b/Box2d/Assets/Program/Box2d/Common/Transform.cs new file mode 100644 index 0000000..b244fb0 --- /dev/null +++ b/Box2d/Assets/Program/Box2d/Common/Transform.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Box2D +{ + class Transform + { + public Transform() + { + + } + + public void Initialize() + { + + } + + public Vec2 position; + public Mat22 R; + } +} diff --git a/Box2d/Assets/Program/Box2d/Common/Transform.cs.meta b/Box2d/Assets/Program/Box2d/Common/Transform.cs.meta new file mode 100644 index 0000000..d8b844b --- /dev/null +++ b/Box2d/Assets/Program/Box2d/Common/Transform.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0ad1c5e9a9ce05e40995e4c863ba9adc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Box2d/Assets/Program/Box2d/Common/Vec2.cs b/Box2d/Assets/Program/Box2d/Common/Vec2.cs index 01f215c..ab803dd 100644 --- a/Box2d/Assets/Program/Box2d/Common/Vec2.cs +++ b/Box2d/Assets/Program/Box2d/Common/Vec2.cs @@ -1,6 +1,6 @@ using System; -namespace Box2d +namespace Box2D { class Vec2 { @@ -34,6 +34,21 @@ namespace Box2d y = v.y; } + public Vec2 GetNegtive() + { + return new Vec2(-x, -y); + } + + public Vec2 Copy() + { + return new Vec2(x, y); + } + + public Vec2 Clone() + { + return new Vec2(x, y); + } + public static Vec2 operator -(Vec2 l, Vec2 r) { Vec2 v = new Vec2(l.x - r.x, l.y - r.y); @@ -87,6 +102,12 @@ namespace Box2d return new Vec2(-y, x); } + public void Abs() + { + if (x < 0) x = -x; + if (y < 0) y = -y; + } + public float x, y; } } diff --git a/Box2d/Assets/Program/Box2d/Common/Vec3.cs b/Box2d/Assets/Program/Box2d/Common/Vec3.cs index 5315fab..d4bb361 100644 --- a/Box2d/Assets/Program/Box2d/Common/Vec3.cs +++ b/Box2d/Assets/Program/Box2d/Common/Vec3.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace Box2d +namespace Box2D { class Vec3 { diff --git a/Box2d/Assets/Program/Box2d/Dynamics/Body.cs b/Box2d/Assets/Program/Box2d/Dynamics/Body.cs index 5b8a47a..85ae672 100644 --- a/Box2d/Assets/Program/Box2d/Dynamics/Body.cs +++ b/Box2d/Assets/Program/Box2d/Dynamics/Body.cs @@ -1,7 +1,7 @@ using System.Collections; using System.Collections.Generic; -namespace Box2d +namespace Box2D { } diff --git a/Box2d/Assets/Program/Box2d/Dynamics/Contacts/Contact.cs b/Box2d/Assets/Program/Box2d/Dynamics/Contacts/Contact.cs index 5b8a47a..85ae672 100644 --- a/Box2d/Assets/Program/Box2d/Dynamics/Contacts/Contact.cs +++ b/Box2d/Assets/Program/Box2d/Dynamics/Contacts/Contact.cs @@ -1,7 +1,7 @@ using System.Collections; using System.Collections.Generic; -namespace Box2d +namespace Box2D { } diff --git a/Box2d/Assets/Program/Box2d/Dynamics/Joints/Joint.cs b/Box2d/Assets/Program/Box2d/Dynamics/Joints/Joint.cs index 5b8a47a..85ae672 100644 --- a/Box2d/Assets/Program/Box2d/Dynamics/Joints/Joint.cs +++ b/Box2d/Assets/Program/Box2d/Dynamics/Joints/Joint.cs @@ -1,7 +1,7 @@ using System.Collections; using System.Collections.Generic; -namespace Box2d +namespace Box2D { } diff --git a/Box2d/Assets/Program/Box2d/Rope/Rope.cs b/Box2d/Assets/Program/Box2d/Rope/Rope.cs index 5b8a47a..85ae672 100644 --- a/Box2d/Assets/Program/Box2d/Rope/Rope.cs +++ b/Box2d/Assets/Program/Box2d/Rope/Rope.cs @@ -1,7 +1,7 @@ using System.Collections; using System.Collections.Generic; -namespace Box2d +namespace Box2D { } diff --git a/Box2d/Assets/Program/Test.meta b/Box2d/Assets/Program/Test.meta deleted file mode 100644 index 3018498..0000000 --- a/Box2d/Assets/Program/Test.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: cb44a5912cadba440b51ae5ea814a52f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Box2d/ProjectSettings/ProjectVersion.txt b/Box2d/ProjectSettings/ProjectVersion.txt index 997bd4a..75a1158 100644 --- a/Box2d/ProjectSettings/ProjectVersion.txt +++ b/Box2d/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2018.2.5f1 +m_EditorVersion: 2018.2.6f1 |