Skip to content

Commit d2b43bb

Browse files
committed
[upstream] Sensor hits (box2d #945)
[upstream] erincatto/box2d#945 Sensor hits for shapes that move fast over sensors. `b2SensorData` that has the visitor shape id and the captured visitor body transform. Bug fix: sensors were not using the custom filter. Time of impact now returns the point and normal. `b2PreSolveFcn` now returns a contact point and normal instead of the manifold. This change was made to support more efficient continuous collision and for consistency. Pre-solve is called in continuous and discrete collision, but continuous collision no longer uses manifolds. Contact push speed is now independent of contact hertz and damping ratio. Bumped version to 3.2.0 (work in progress). Renamed: `b2Shape_GetMassData` to `b2Shape_ComputeMassData` Removed: `b2Contact_GetManifold` and `b2Contact_GetShapeIds` Added: `b2Contact_GetData` Changed function order on some collision functions to assist editor auto-complete `id.h` is now stand-alone Renamed: `b2WorldDef::maxContactPushSpeed` to `contactSpeed` Added: `b2BodyDef::enableSensorHits` Added: `b2JointDef::constraintHertz` and `b2JointDef::constraintDampingRatio` Renamed: `b2JointDef::drawSize` to `b2JointDef::drawScale` Removed: `b2ContactBeginTouchEvent::manifold` Added: `b2ContactData::contactId` Modified: `b2PreSolveFcn` receives a point and normal instead of a manifold 5st
1 parent d8552e2 commit d2b43bb

File tree

92 files changed

+994
-505
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+994
-505
lines changed

src/Box2D.NET.Samples/Camera.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ public class Camera
1212
{
1313
public B2Vec2 m_center;
1414
public float m_zoom;
15-
public int m_width;
16-
public int m_height;
15+
public float m_width;
16+
public float m_height;
1717

1818
public Camera()
1919
{

src/Box2D.NET.Samples/Draw.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public void DrawSolidCapsule(B2Vec2 p1, B2Vec2 p2, float radius, B2HexColor colo
152152
m_solidCapsules.AddCapsule(p1, p2, radius, color);
153153
}
154154

155-
public void DrawSegment(B2Vec2 p1, B2Vec2 p2, B2HexColor color)
155+
public void DrawLine(B2Vec2 p1, B2Vec2 p2, B2HexColor color)
156156
{
157157
m_lines.AddLine(p1, p2, color);
158158
}
@@ -205,7 +205,7 @@ public void DrawString(B2Vec2 p, string message)
205205
ImGui.End();
206206
}
207207

208-
public void DrawAABB(B2AABB aabb, B2HexColor c)
208+
public void DrawBounds(B2AABB aabb, B2HexColor c)
209209
{
210210
B2Vec2 p1 = aabb.lowerBound;
211211
B2Vec2 p2 = new B2Vec2(aabb.upperBound.X, aabb.lowerBound.Y);
@@ -261,7 +261,7 @@ public static void DrawSolidCapsuleFcn(B2Vec2 p1, B2Vec2 p2, float radius, B2Hex
261261

262262
public static void DrawSegmentFcn(B2Vec2 p1, B2Vec2 p2, B2HexColor color, object context)
263263
{
264-
(context as Draw).DrawSegment(p1, p2, color);
264+
(context as Draw).DrawLine(p1, p2, color);
265265
}
266266

267267
public static void DrawTransformFcn(B2Transform transform, object context)

src/Box2D.NET.Samples/SampleApp.cs

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class SampleApp
4141
private SampleContext _context;
4242
private bool s_rightMouseDown = false;
4343
private B2Vec2 s_clickPointWS = b2Vec2_zero;
44-
private float s_windowScale = 1.0f;
44+
private float s_fontScale = 1.0f;
4545
private float s_framebufferScale = 1.0f;
4646
private float _frameTime = 0.0f;
4747

@@ -100,7 +100,7 @@ public int Run(string[] args)
100100
}
101101
else
102102
{
103-
_context.glfw.GetMonitorContentScale(primaryMonitor, out s_windowScale, out s_windowScale);
103+
_context.glfw.GetMonitorContentScale(primaryMonitor, out s_fontScale, out s_fontScale);
104104
}
105105
}
106106
}
@@ -109,13 +109,13 @@ public int Run(string[] args)
109109
bool fullscreen = false;
110110
if (fullscreen)
111111
{
112-
options.Size = new Vector2D<int>((int)(1920 * s_windowScale), (int)(1080 * s_windowScale));
113-
//_ctx.g_mainWindow = _ctx.g_glfw.CreateWindow((int)(1920 * s_windowScale), (int)(1080 * s_windowScale), buffer, _ctx.g_glfw.GetPrimaryMonitor(), null);
112+
options.Size = new Vector2D<int>((int)(1920), (int)(1080));
113+
//_context.g_mainWindow = _context.g_glfw.CreateWindow((int)(1920 ), (int)(1080 ), buffer, _ctx.g_glfw.GetPrimaryMonitor(), null);
114114
}
115115
else
116116
{
117-
options.Size = new Vector2D<int>((int)(_context.camera.m_width * s_windowScale), (int)(_context.camera.m_height * s_windowScale));
118-
//_ctx.g_mainWindow = _ctx.g_glfw.CreateWindow((int)(_ctx.g_camera.m_width * s_windowScale), (int)(_ctx.g_camera.m_height * s_windowScale), buffer, null, null);
117+
options.Size = new Vector2D<int>((int)(_context.camera.m_width), (int)(_context.camera.m_height));
118+
//_context.g_mainWindow = _ctx.g_glfw.CreateWindow((int)(_ctx.g_camera.m_width * s_windowScale), (int)(_ctx.g_camera.m_height * s_windowScale), buffer, null, null);
119119
}
120120

121121
_window = Window.Create(options);
@@ -157,11 +157,11 @@ private void OnWindowResize(Vector2D<int> resize)
157157
{
158158
var width = resize.X;
159159
var height = resize.Y;
160-
_context.settings.windowWidth = (int)(width / s_windowScale);
161-
_context.settings.windowHeight = (int)(height / s_windowScale);
160+
_context.settings.windowWidth = width;
161+
_context.settings.windowHeight = height;
162162

163-
_context.camera.m_width = (int)(width / s_windowScale);
164-
_context.camera.m_height = (int)(height / s_windowScale);
163+
_context.camera.m_width = width;
164+
_context.camera.m_height = height;
165165
}
166166

167167
private void OnWindowFrameBufferResize(Vector2D<int> resize)
@@ -196,14 +196,14 @@ private void OnWindowLoad()
196196
return;
197197
}
198198

199-
// if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
200-
// {
201-
// _ctx.g_glfw.GetWindowContentScale(_ctx.g_mainWindow, out s_framebufferScale, out s_framebufferScale);
202-
// }
203-
// else
204-
// {
205-
// _ctx.g_glfw.GetWindowContentScale(_ctx.g_mainWindow, out s_windowScale, out s_windowScale);
206-
// }
199+
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
200+
{
201+
//_context.glfw.GetWindowContentScale(_context.window, out s_framebufferScale, out s_framebufferScale);
202+
}
203+
else
204+
{
205+
//_context.glfw.GetWindowContentScale(_context.window, out s_fontScale, out s_fontScale);
206+
}
207207

208208
_context.glfw.MakeContextCurrent(_context.window);
209209
}
@@ -497,11 +497,13 @@ private void CreateUI(string glslVersion)
497497
// var imGuiIo = ImGui.GetIO();
498498
// var s = new ImFontConfig();
499499
// ImFontConfigPtr fontConfig = new ImFontConfigPtr(&s);
500-
// fontConfig.RasterizerMultiply = s_windowScale * s_framebufferScale;
501-
// _ctx.draw.m_smallFont = imGuiIo.Fonts.AddFontFromFileTTF(fontPath, 14.0f, fontConfig, IntPtr.Zero);
502-
// _ctx.draw.m_regularFont = imGuiIo.Fonts.AddFontFromFileTTF(fontPath, 18.0f, fontConfig, IntPtr.Zero);
503-
// _ctx.draw.m_mediumFont = imGuiIo.Fonts.AddFontFromFileTTF(fontPath, 40.0f, fontConfig, IntPtr.Zero);
504-
// _ctx.draw.m_largeFont = imGuiIo.Fonts.AddFontFromFileTTF(fontPath, 64.0f, fontConfig, IntPtr.Zero);
500+
// fontConfig.RasterizerMultiply = s_fontScale * s_framebufferScale;
501+
// _context.draw.m_smallFont = imGuiIo.Fonts.AddFontFromFileTTF(fontPath, 14.0f * s_fontScale, fontConfig, IntPtr.Zero);
502+
// _context.draw.m_regularFont = imGuiIo.Fonts.AddFontFromFileTTF(fontPath, 18.0f * s_fontScale, fontConfig, IntPtr.Zero);
503+
// _context.draw.m_mediumFont = imGuiIo.Fonts.AddFontFromFileTTF(fontPath, 40.0f * s_fontScale, fontConfig, IntPtr.Zero);
504+
// _context.draw.m_largeFont = imGuiIo.Fonts.AddFontFromFileTTF(fontPath, 64.0f * s_fontScale, fontConfig, IntPtr.Zero);
505+
506+
//imGuiIo.FontDefault = _context.draw.m_smallFont;
505507
}
506508

507509
public void DestroyUI()
@@ -651,7 +653,7 @@ private unsafe void MouseButtonCallback(WindowHandle* window, MouseButton button
651653

652654
double xd, yd;
653655
_context.glfw.GetCursorPos(_context.window, out xd, out yd);
654-
B2Vec2 ps = new B2Vec2((float)(xd / s_windowScale), (float)(yd / s_windowScale));
656+
B2Vec2 ps = new B2Vec2((float)(xd), (float)(yd));
655657

656658
// Use the mouse to move things around.
657659
if (button == (int)MouseButton.Left)
@@ -684,7 +686,7 @@ private unsafe void MouseButtonCallback(WindowHandle* window, MouseButton button
684686

685687
private unsafe void MouseMotionCallback(WindowHandle* window, double xd, double yd)
686688
{
687-
B2Vec2 ps = new B2Vec2((float)(xd / s_windowScale), (float)(yd / s_windowScale));
689+
B2Vec2 ps = new B2Vec2((float)(xd), (float)(yd));
688690

689691
//ImGui_ImplGlfw_CursorPosCallback(window, ps.x, ps.y);
690692

src/Box2D.NET.Samples/Samples/Benchmarks/BenchmarkCast.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public override void Step()
227227

228228
B2Vec2 p1 = m_origins[m_drawIndex];
229229
B2Vec2 p2 = p1 + m_translations[m_drawIndex];
230-
m_draw.DrawSegment(p1, p2, B2HexColor.b2_colorWhite);
230+
m_draw.DrawLine(p1, p2, B2HexColor.b2_colorWhite);
231231
m_draw.DrawPoint(p1, 5.0f, B2HexColor.b2_colorGreen);
232232
m_draw.DrawPoint(p2, 5.0f, B2HexColor.b2_colorRed);
233233
if (drawResult.hit)
@@ -266,7 +266,7 @@ public override void Step()
266266

267267
B2Vec2 p1 = m_origins[m_drawIndex];
268268
B2Vec2 p2 = p1 + m_translations[m_drawIndex];
269-
m_draw.DrawSegment(p1, p2, B2HexColor.b2_colorWhite);
269+
m_draw.DrawLine(p1, p2, B2HexColor.b2_colorWhite);
270270
m_draw.DrawPoint(p1, 5.0f, B2HexColor.b2_colorGreen);
271271
m_draw.DrawPoint(p2, 5.0f, B2HexColor.b2_colorRed);
272272
if (drawResult.hit)
@@ -310,7 +310,7 @@ public override void Step()
310310
B2Vec2 origin = m_origins[m_drawIndex];
311311
B2AABB aabb = new B2AABB(origin - extent, origin + extent);
312312

313-
m_draw.DrawAABB(aabb, B2HexColor.b2_colorWhite);
313+
m_draw.DrawBounds(aabb, B2HexColor.b2_colorWhite);
314314
}
315315

316316
for (int i = 0; i < drawResult.count; ++i)

src/Box2D.NET.Samples/Samples/Benchmarks/BenchmarkSensor.cs

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using static Box2D.NET.B2Shapes;
1111
using static Box2D.NET.Shared.RandomSupports;
1212
using static Box2D.NET.B2Worlds;
13+
using static Box2D.NET.B2Diagnostics;
1314

1415
namespace Box2D.NET.Samples.Samples.Benchmarks;
1516

@@ -19,16 +20,18 @@ public class BenchmarkSensor : Sample
1920

2021
public class ShapeUserData
2122
{
22-
public bool shouldDestroyVisitors;
23+
public int row;
24+
public bool active;
2325
};
2426

2527
private const int m_columnCount = 40;
2628
private const int m_rowCount = 40;
2729
private int m_maxBeginCount;
2830
private int m_maxEndCount;
29-
private ShapeUserData m_passiveSensor = new ShapeUserData();
31+
private ShapeUserData[] m_passiveSensors = new ShapeUserData[m_rowCount];
3032
private ShapeUserData m_activeSensor = new ShapeUserData();
3133
private int m_lastStepCount;
34+
private int m_filterRow;
3235

3336
private static Sample Create(SampleContext context)
3437
{
@@ -43,8 +46,10 @@ public BenchmarkSensor(SampleContext context) : base(context)
4346
m_camera.m_zoom = 125.0f;
4447
}
4548

46-
m_passiveSensor.shouldDestroyVisitors = false;
47-
m_activeSensor.shouldDestroyVisitors = true;
49+
b2World_SetCustomFilterCallback(m_worldId, FilterFcn, this);
50+
51+
m_activeSensor.row = 0;
52+
m_activeSensor.active = true;
4853

4954
B2BodyDef bodyDef = b2DefaultBodyDef();
5055
B2BodyId groundId = b2CreateBody(m_worldId, ref bodyDef);
@@ -76,18 +81,21 @@ public BenchmarkSensor(SampleContext context) : base(context)
7681
B2ShapeDef shapeDef = b2DefaultShapeDef();
7782
shapeDef.isSensor = true;
7883
shapeDef.enableSensorEvents = true;
79-
shapeDef.userData = m_passiveSensor;
8084

8185
float yStart = 10.0f;
8286

8387
for (int j = 0; j < m_rowCount; ++j)
8488
{
89+
m_passiveSensors[j] = new ShapeUserData();
90+
m_passiveSensors[j].row = j;
91+
m_passiveSensors[j].active = false;
92+
shapeDef.userData = m_passiveSensors[j];
93+
8594
float y = j * shift + yStart;
8695
for (int i = 0; i < m_columnCount; ++i)
8796
{
8897
float x = i * shift - xCenter;
89-
float yOffset = RandomFloatRange(-1.0f, 1.0f);
90-
B2Polygon box = b2MakeOffsetRoundedBox(0.5f, 0.5f, new B2Vec2(x, y + yOffset), RandomRot(), 0.1f);
98+
B2Polygon box = b2MakeOffsetRoundedBox(0.5f, 0.5f, new B2Vec2(x, y), b2Rot_identity, 0.1f);
9199
b2CreatePolygonShape(groundId, ref shapeDef, ref box);
92100
}
93101
}
@@ -96,6 +104,7 @@ public BenchmarkSensor(SampleContext context) : base(context)
96104
m_maxBeginCount = 0;
97105
m_maxEndCount = 0;
98106
m_lastStepCount = 0;
107+
m_filterRow = m_rowCount >> 1;
99108
}
100109

101110
void CreateRow(float y)
@@ -114,13 +123,41 @@ void CreateRow(float y)
114123
B2Circle circle = new B2Circle(new B2Vec2(0.0f, 0.0f), 0.5f);
115124
for (int i = 0; i < m_columnCount; ++i)
116125
{
117-
bodyDef.position = new B2Vec2(shift * i - xCenter, y);
126+
// stagger bodies to avoid bunching up events into a single update
127+
float yOffset = RandomFloatRange(-1.0f, 1.0f);
128+
bodyDef.position = new B2Vec2(shift * i - xCenter, y + yOffset);
118129
B2BodyId bodyId = b2CreateBody(m_worldId, ref bodyDef);
119130

120131
b2CreateCircleShape(bodyId, ref shapeDef, ref circle);
121132
}
122133
}
123134

135+
private bool Filter(B2ShapeId idA, B2ShapeId idB)
136+
{
137+
ShapeUserData userData = null;
138+
if (b2Shape_IsSensor(idA))
139+
{
140+
userData = b2Shape_GetUserData(idA) as ShapeUserData;
141+
}
142+
else if (b2Shape_IsSensor(idB))
143+
{
144+
userData = b2Shape_GetUserData(idB) as ShapeUserData;
145+
}
146+
147+
if (userData != null)
148+
{
149+
return userData.active == true || userData.row != m_filterRow;
150+
}
151+
152+
return true;
153+
}
154+
155+
private static bool FilterFcn(B2ShapeId idA, B2ShapeId idB, object context)
156+
{
157+
BenchmarkSensor self = context as BenchmarkSensor;
158+
return self.Filter(idA, idB);
159+
}
160+
124161
public override void Step()
125162
{
126163
base.Step();
@@ -139,12 +176,15 @@ public override void Step()
139176

140177
// shapes on begin touch are always valid
141178
ShapeUserData userData = (ShapeUserData)b2Shape_GetUserData(@event.sensorShapeId);
142-
if (userData.shouldDestroyVisitors)
179+
if (userData.active)
143180
{
144181
zombies.Add(b2Shape_GetBody(@event.visitorShapeId));
145182
}
146183
else
147184
{
185+
// Check custom filter correctness
186+
B2_ASSERT(userData.row != m_filterRow);
187+
148188
// Modify color while overlapped with a sensor
149189
B2SurfaceMaterial surfaceMaterial = b2Shape_GetSurfaceMaterial(@event.visitorShapeId);
150190
surfaceMaterial.customColor = (uint)B2HexColor.b2_colorLime;

src/Box2D.NET.Samples/Samples/Benchmarks/BenchmarkShapeDistance.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ public override void Draw(Settings settings)
160160
B2DistanceOutput output = m_outputs[m_drawIndex];
161161
m_draw.DrawSolidPolygon(ref xfA, m_polygonA.vertices.AsSpan(), m_polygonA.count, m_polygonA.radius, B2HexColor.b2_colorBox2DGreen);
162162
m_draw.DrawSolidPolygon(ref xfB, m_polygonB.vertices.AsSpan(), m_polygonB.count, m_polygonB.radius, B2HexColor.b2_colorBox2DBlue);
163-
m_draw.DrawSegment(output.pointA, output.pointB, B2HexColor.b2_colorDimGray);
163+
m_draw.DrawLine(output.pointA, output.pointB, B2HexColor.b2_colorDimGray);
164164
m_draw.DrawPoint(output.pointA, 10.0f, B2HexColor.b2_colorWhite);
165165
m_draw.DrawPoint(output.pointB, 10.0f, B2HexColor.b2_colorWhite);
166-
m_draw.DrawSegment(output.pointA, output.pointA + 0.5f * output.normal, B2HexColor.b2_colorYellow);
166+
m_draw.DrawLine(output.pointA, output.pointA + 0.5f * output.normal, B2HexColor.b2_colorYellow);
167167
DrawTextLine($"distance = {output.distance}");
168168
}
169169
}

src/Box2D.NET.Samples/Samples/Bodies/Kinematic.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public override void Draw(Settings settings)
7878
B2Rot rotation = b2MakeRot(2.0f * m_time);
7979

8080
B2Vec2 axis = b2RotateVector(rotation, new B2Vec2(0.0f, 1.0f));
81-
m_draw.DrawSegment(point - 0.5f * axis, point + 0.5f * axis, B2HexColor.b2_colorPlum);
81+
m_draw.DrawLine(point - 0.5f * axis, point + 0.5f * axis, B2HexColor.b2_colorPlum);
8282
m_draw.DrawPoint(point, 10.0f, B2HexColor.b2_colorPlum);
8383

8484
b2Body_SetTargetTransform(m_bodyId, new B2Transform(point, rotation), m_timeStep);

src/Box2D.NET.Samples/Samples/Bodies/Weeble.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public override void Draw(Settings settings)
135135
B2Vec2 v2 = b2Body_GetWorldPointVelocity(m_weebleId, worldPoint);
136136

137137
B2Vec2 offset = new B2Vec2(0.05f, 0.0f);
138-
m_draw.DrawSegment(worldPoint, worldPoint + v1, B2HexColor.b2_colorRed);
139-
m_draw.DrawSegment(worldPoint + offset, worldPoint + v2 + offset, B2HexColor.b2_colorGreen);
138+
m_draw.DrawLine(worldPoint, worldPoint + v1, B2HexColor.b2_colorRed);
139+
m_draw.DrawLine(worldPoint + offset, worldPoint + v2 + offset, B2HexColor.b2_colorGreen);
140140
}
141141
}

src/Box2D.NET.Samples/Samples/Characters/Mover.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ void SolveMove(float timeStep, float throttle)
378378
m_pogoVelocity = 0.0f;
379379

380380
B2Vec2 delta = translation;
381-
m_draw.DrawSegment(origin, origin + delta, B2HexColor.b2_colorGray);
381+
m_draw.DrawLine(origin, origin + delta, B2HexColor.b2_colorGray);
382382

383383
if (m_pogoShape == (int)PogoShape.PogoPoint)
384384
{
@@ -390,7 +390,7 @@ void SolveMove(float timeStep, float throttle)
390390
}
391391
else
392392
{
393-
m_draw.DrawSegment(segment.point1 + delta, segment.point2 + delta, B2HexColor.b2_colorGray);
393+
m_draw.DrawLine(segment.point1 + delta, segment.point2 + delta, B2HexColor.b2_colorGray);
394394
}
395395
}
396396
else
@@ -401,7 +401,7 @@ void SolveMove(float timeStep, float throttle)
401401
m_pogoVelocity = b2SpringDamper(m_pogoHertz, m_pogoDampingRatio, offset, m_pogoVelocity, timeStep);
402402

403403
B2Vec2 delta = castResult.fraction * translation;
404-
m_draw.DrawSegment(origin, origin + delta, B2HexColor.b2_colorGray);
404+
m_draw.DrawLine(origin, origin + delta, B2HexColor.b2_colorGray);
405405

406406
if (m_pogoShape == (int)PogoShape.PogoPoint)
407407
{
@@ -413,7 +413,7 @@ void SolveMove(float timeStep, float throttle)
413413
}
414414
else
415415
{
416-
m_draw.DrawSegment(segment.point1 + delta, segment.point2 + delta, B2HexColor.b2_colorPlum);
416+
m_draw.DrawLine(segment.point1 + delta, segment.point2 + delta, B2HexColor.b2_colorPlum);
417417
}
418418

419419
b2Body_ApplyForce(castResult.bodyId, new B2Vec2(0.0f, -50.0f), castResult.point, true);
@@ -623,7 +623,7 @@ public override void Draw(Settings settings)
623623
B2Vec2 p1 = m_transform.p + (plane.offset - m_capsule.radius) * plane.normal;
624624
B2Vec2 p2 = p1 + 0.1f * plane.normal;
625625
m_draw.DrawPoint(p1, 5.0f, B2HexColor.b2_colorYellow);
626-
m_draw.DrawSegment(p1, p2, B2HexColor.b2_colorYellow);
626+
m_draw.DrawLine(p1, p2, B2HexColor.b2_colorYellow);
627627
}
628628

629629
{
@@ -632,7 +632,7 @@ public override void Draw(Settings settings)
632632

633633
B2HexColor color = m_onGround ? B2HexColor.b2_colorOrange : B2HexColor.b2_colorAquamarine;
634634
m_draw.DrawSolidCapsule(p1, p2, m_capsule.radius, color);
635-
m_draw.DrawSegment(m_transform.p, m_transform.p + m_velocity, B2HexColor.b2_colorPurple);
635+
m_draw.DrawLine(m_transform.p, m_transform.p + m_velocity, B2HexColor.b2_colorPurple);
636636
}
637637

638638
B2Vec2 p = m_transform.p;

0 commit comments

Comments
 (0)