Fix debug draw and physics positioning issues

- Fix critical bug in PlanckDebugDraw.js where circles were drawn at body center instead of local positions
- Add DEBUG_DRAW_SENSORS support with orange styling and no outlines
- Fix Chuck's sprite positioning to align with physics body center (pivot adjustments)
- Correct fixture Y coordinates so Chuck stands upright instead of on his head
- Position foot sensor correctly below legs for proper ground detection
- Remove cyan crosses and make yellow center-of-mass crosses smaller
- Make debug lines thinner for cleaner visualization
This commit is contained in:
Karl Pannek 2025-07-16 23:40:40 +02:00
parent d584065757
commit 49f4591d3a
5 changed files with 205 additions and 162 deletions

View file

@ -0,0 +1,27 @@
/*
* Licensed under the MIT License
* Copyright (c) Erin Catto
*/
// TODO_ERIN test joints on compounds.
planck.testbed('CompoundShapes', function(testbed) {
var pl = planck, Vec2 = pl.Vec2, Transform = pl.Transform;
var world = new pl.World(Vec2(0, -10));
world.createBody(Vec2(0.0, 0.0)).createFixture(pl.Edge(Vec2(50.0, 0.0), Vec2(-50.0, 0.0)), 0.0);
var headshape = pl.Circle(Vec2(0.0, 1.0), 0.5);
var legsshape = pl.Circle(Vec2(0.0, -1.0), 0.5);
var bodyshape = pl.Box(0.25, 0.5);
// Create one body with circles and polygons
var body = world.createDynamicBody({
position : Vec2(pl.Math.random(-0.1, 0.1), 1.05),
angle : pl.Math.random(-Math.PI, Math.PI)
});
body.createFixture(headshape, 2.0);
body.createFixture(legsshape, 0.0);
body.createFixture(bodyshape, 2.0);
return world;
});