One-way platforms, raycast and collision stay with contact data: a collider can be one-way with a side it blocks from (turning with its object, drawn thick in the scene view) and a tile can be one-way from above, one-way cells never merge with solid tiles, a contact blocks only when its normal is within 45 degrees of the blocking side, the new node Ignore one-way lets an object drop through for a while, and it all holds for Move and for dynamic bodies in Rapier, where the decision is made before each step because the hook may not touch the engine (#155); the new Raycast node answers hit, object, collider, point, normal and distance in our own f64 geometry, the same in editor run and play, and the editor run draws each ray for 0.25 s (#153); On collision stay gains an interval with its own clock per pair, and stay and enter gain the contact point next to normal and impulse (#149); fixes that every Rapier collider of a tilemap had the shape of its last cell
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
947a6b1977
commit
6a31f5e0ad
33 files changed
+2064
-125
No files matched your search
@@ -697,3 +697,31 @@ describe('Move with "Collide with solids" pushes dynamic bodies (#147)', () => {
|
||||
expect(gap).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('a tilemap in the engine keeps every cell its own shape', () => {
|
||||
it('a collider without a rigidbody overlapping the first of two solid cells collides with the map', () => {
|
||||
const f = physicsScene();
|
||||
const solid = new CreateAssetCommand('tile', 'Wall');
|
||||
const map = new CreateAssetCommand('tilemap', 'Ground');
|
||||
f.stack.execute(solid);
|
||||
f.stack.execute(map);
|
||||
f.stack.execute(new SetAssetPropertyCommand(solid.asset.id, TILE_SOLID_KEY, true));
|
||||
f.stack.execute(new SetAssetPropertyCommand(map.asset.id, TILEMAP_COLUMNS_KEY, 10));
|
||||
f.stack.execute(new SetAssetPropertyCommand(map.asset.id, TILEMAP_ROWS_KEY, 10));
|
||||
const mapObject = place(f, map.asset.id, { x: 0, y: 0 });
|
||||
const layer = (findAsset(f.project, map.asset.id) as TilemapAsset).layers[0]!.id;
|
||||
// Cells of 48, centred: cell (0, 0) spans −240 … −192, cell (9, 9) spans 192 … 240.
|
||||
const cells = [
|
||||
{ x: 0, y: 0, tileId: solid.asset.id },
|
||||
{ x: 9, y: 9, tileId: solid.asset.id },
|
||||
];
|
||||
f.stack.execute(new PaintTilesCommand(map.asset.id, layer, cells));
|
||||
const first = f.add(-216, -216, { w: 20 });
|
||||
const last = f.add(216, 216, { w: 20 });
|
||||
const { physics, world, entity, frame } = run(f);
|
||||
frame(1 / 60);
|
||||
frame(1 / 60);
|
||||
expect(physics.touching(world, entity(first), entity(mapObject))).toBe(true);
|
||||
expect(physics.touching(world, entity(last), entity(mapObject))).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user