Skip to content

Implement individual hitboxes for asteroids - #8

Open
wannerdev wants to merge 2 commits into
mainfrom
bugfix/individual-asteroid-hitboxes
Open

Implement individual hitboxes for asteroids#8
wannerdev wants to merge 2 commits into
mainfrom
bugfix/individual-asteroid-hitboxes

Conversation

@wannerdev

Copy link
Copy Markdown
Owner

Description

Fixes collision detection for asteroids by giving each individual asteroid its own hitbox instead of treating the entire swarm as a single collision object.

Changes

  • Removed single HitBox from AsteroidSwarm parent entity
  • Added individual HitBox component to each Asteroid child entity
  • Each asteroid now has a radius of 2.5 for precise collision detection
  • Added Level component to individual asteroids for proper collision handling
  • Improves collision accuracy for asteroid-satellite interactions

Bug Details

Before: The entire asteroid swarm had one hitbox (radius 14.0) at the swarm center, making collision detection imprecise and treating all asteroids as a single object.

After: Each asteroid has its own hitbox (radius 2.5) at its actual position, enabling accurate per-asteroid collision detection.

Benefits

  • More realistic and fair collision detection
  • Players can navigate between asteroids in a swarm
  • Individual asteroids can be destroyed separately
  • Better gameplay experience with precise physics
  • Matches visual representation of separate asteroids

Technical Details

  • Asteroid hitbox radius: 2.5 (appropriate for visual size)
  • Previous swarm hitbox radius: 14.0 (covered entire cluster)
  • Each asteroid is a child entity with its own Transform and HitBox
  • Collision system now detects individual asteroid collisions

Testing

  • Launch satellites through asteroid swarms
  • Verify collisions only occur when hitting individual asteroids
  • Check that satellites can pass between asteroids safely
  • Confirm each asteroid can be destroyed independently
  • Test with debug mode to visualize individual hitboxes

Related Issue

Fixes: Bug - Asteroids should have individual hitboxes

Suna AI Agent added 2 commits October 19, 2025 05:30
- Removed single hitbox from AsteroidSwarm parent entity
- Added individual HitBox component to each Asteroid child
- Each asteroid now has radius of 2.5 for precise collision detection
- Added Level component to individual asteroids
- Improves collision accuracy for asteroid-satellite interactions
- Fixes issue where entire swarm was treated as single collision object
- Added Attractee component so asteroids are affected by gravity
- Added GravityForce component for force calculations
- Added Mass component (0.1) for physics interactions
- Added necessary imports for physics components
- Asteroids now properly render and move with gravity
- Fixes issue where asteroids disappeared after PR #8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant