Skip to content

Commit 4dbbbbe

Browse files
authored
Merge pull request #26 from thomasvt/master
Contact.Distance() results were wrong due to missing ref keywords when writing to structs.
2 parents b5a55cb + a6d6389 commit 4dbbbbe

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/box2dx/Box2D.NetStandard/Collision/Simplex.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ internal void ReadCache(
7171
SimplexVertex[] vertices = m_v;
7272
for (var i = 0; i < m_count; ++i)
7373
{
74-
SimplexVertex v = vertices[i];
74+
ref SimplexVertex v = ref vertices[i];
7575
v.indexA = cache.indexA[i];
7676
v.indexB = cache.indexB[i];
7777
Vector2 wALocal = proxyA.GetVertex(v.indexA);
@@ -98,7 +98,7 @@ internal void ReadCache(
9898
// If the cache is empty or invalid ...
9999
if (m_count == 0)
100100
{
101-
SimplexVertex v = vertices[0];
101+
ref SimplexVertex v = ref vertices[0];
102102
v.indexA = 0;
103103
v.indexB = 0;
104104
Vector2 wALocal = proxyA.GetVertex(0);

src/box2dx/Box2D.NetStandard/Dynamics/Contacts/Contact.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ internal static void Distance(out DistanceOutput output, SimplexCache cache, in
499499
}
500500

501501
// Compute a tentative new simplex vertex using support points.
502-
SimplexVertex vertex = vertices[simplex.m_count];
502+
ref SimplexVertex vertex = ref vertices[simplex.m_count];
503503
vertex.indexA = proxyA.GetSupport(Math.MulT(transformA.q, -d));
504504
vertex.wA = Math.Mul(transformA, proxyA.GetVertex(vertex.indexA));
505505
vertex.indexB = proxyB.GetSupport(Math.MulT(transformB.q, d));

src/box2dx/Box2D.NetStandard/Dynamics/Fixtures/Fixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace Box2D.NetStandard.Dynamics.Fixtures
4444
/// Fixtures are created via Body.CreateFixture.
4545
/// @warning you cannot reuse fixtures.
4646
/// </summary>
47-
[DebuggerDisplay("Fixture of {m_body.m_userData}")]
47+
[DebuggerDisplay("Fixture of {m_body.UserData}")]
4848
public class Fixture
4949
{
5050
internal Body m_body;

0 commit comments

Comments
 (0)