give collectibales physics layer

this keeps keys, dropped-hedz and cash from "colliding" with the camera arm
This commit is contained in:
2025-05-05 23:17:42 +02:00
parent 1ff7fefe38
commit fc300dae01
4 changed files with 10 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
use crate::{
GameState, billboards::Billboard, global_observer, loading_assets::GameAssets, player::Player,
sounds::PlaySound, squish_animation::SquishAnimation,
GameState, billboards::Billboard, global_observer, loading_assets::GameAssets,
physics_layers::GameLayer, player::Player, sounds::PlaySound,
squish_animation::SquishAnimation,
};
use avian3d::prelude::*;
use bevy::prelude::*;
@@ -40,6 +41,7 @@ fn on_head_drop(trigger: Trigger<HeadDrops>, mut commands: Commands, assets: Res
ExternalImpulse::new(spawn_dir * 180.).with_persistence(false),
LockedAxes::ROTATION_LOCKED,
RigidBody::Dynamic,
CollisionLayers::new(LayerMask(GameLayer::Collectibles.to_bits()), LayerMask::ALL),
CollisionEventsEnabled,
Restitution::new(0.6),
))

View File

@@ -1,6 +1,7 @@
use crate::{
GameState, billboards::Billboard, global_observer, loading_assets::GameAssets, player::Player,
sounds::PlaySound, squish_animation::SquishAnimation,
GameState, billboards::Billboard, global_observer, loading_assets::GameAssets,
physics_layers::GameLayer, player::Player, sounds::PlaySound,
squish_animation::SquishAnimation,
};
use avian3d::prelude::*;
use bevy::prelude::*;
@@ -37,6 +38,7 @@ fn on_spawn_key(trigger: Trigger<KeySpawn>, mut commands: Commands, assets: Res<
ExternalImpulse::new(spawn_dir * 180.).with_persistence(false),
LockedAxes::ROTATION_LOCKED,
RigidBody::Dynamic,
CollisionLayers::new(LayerMask(GameLayer::Collectibles.to_bits()), LayerMask::ALL),
CollisionEventsEnabled,
Restitution::new(0.6),
Children::spawn(Spawn((

View File

@@ -8,4 +8,5 @@ pub enum GameLayer {
Player,
Npc,
Projectile,
Collectibles,
}

View File

@@ -168,6 +168,7 @@ impl CashSpawn {
SceneRoot(mesh),
Cash,
Collider::cuboid(2., 3.0, 2.),
CollisionLayers::new(LayerMask(GameLayer::Collectibles.to_bits()), LayerMask::ALL),
CollisionEventsEnabled,
Sensor,
));