jcornaz / heron

[DISCONTINUED] An ergonomic physics API for bevy games
MIT License
292 stars 44 forks source link

feat: Collision layers #101

Closed jcornaz closed 3 years ago

jcornaz commented 3 years ago

Resolves #36

This introduces layers.

One can now mark an enum as being the list of physics layers:

#[derive(PhysicsLayer)]
enum MyGameLayer {
  World,
  Player,
  Enemy,
  HitBox,
  HurtBox,
  // etc.
}

And then add the new CollisionLayers component to entities:

player_entity.insert(
  CollisionLayers::none()
    .with_group(Layer::Player)
    .with_mask(Layer::World),
);