Fix smash item physics radius to align visual bottom edge with collision boundary

The circle hitbox was using a radius of 22 * WORLD_SCALE, which caused gravity items to hover above the ground and other bodies due to a gap between their visual bottom edge and physical collision boundary. Reduced the radius to 16 * WORLD_SCALE (displaySize/4) so that the Matter.js body's on-screen radius of 64 world pixels matches the item's actual visual extent, ensuring items land flush with terrain and other objects instead of floating above them.
This commit is contained in:
Brian Fertig 2026-08-22 16:20:22 -06:00
parent d9b6a754d8
commit cdc26001fd
1 changed files with 10 additions and 1 deletions

View File

@ -213,7 +213,16 @@ export const SCORE = {
// which fly under a reduced fraction, see KID.ejectedGravityScale), // which fly under a reduced fraction, see KID.ejectedGravityScale),
// tumbling as it goes, then lands and stays where it lands. // tumbling as it goes, then lands and stays where it lands.
export const SMASH_ITEM = { export const SMASH_ITEM = {
radius: 22 * WORLD_SCALE, // circle hitbox (~70% of the 64px frame's display half) // Circle hitbox. The spritesheet art sits in the LOWER half of each 64x64
// cell and fills down to the very bottom of that cell, so an item's VISUAL
// bottom edge is exactly displayHalf (= SMASH_ITEM.displaySize / 2 = 64
// world px) below its centre. In this build a Matter circle's on-screen
// radius is 2x the value passed to shape.radius (32 -> 64 world px, the
// game's own convention), so we pass displaySize/4 to make the PHYSICAL
// bottom coincide with the VISUAL bottom. That is what stops a gravity item
// from hovering above the ground - its art actually reaches the terrain
// (and any other body it falls onto) instead of floating a gap above it.
radius: 16 * WORLD_SCALE, // = SMASH_ITEM.displaySize / 4 (body radius -> 64)
displaySize: 64 * WORLD_SCALE, // one 64x64 frame, shown square displaySize: 64 * WORLD_SCALE, // one 64x64 frame, shown square
density: 0.001, density: 0.001,
friction: 0.5, friction: 0.5,