1- use crate :: {
2- asset_tracking:: LoadResource , third_party:: bevy_trenchbroom:: GetTrenchbroomModelPath as _,
3- } ;
1+ use crate :: { asset_tracking:: LoadResource , third_party:: bevy_trenchbroom:: GetTrenchbroomModelPath } ;
42
53use super :: setup:: * ;
4+ use avian3d:: prelude:: { ColliderConstructor , RigidBody } ;
65use bevy:: prelude:: * ;
76use bevy_trenchbroom:: prelude:: * ;
87
98pub ( super ) fn plugin ( app : & mut App ) {
10- app. add_observer ( setup_static_prop_with_convex_hull :: < Grate > )
11- . add_observer ( setup_static_prop_with_convex_decomposition :: < Table > )
12- . add_observer ( setup_static_prop_with_convex_hull :: < Bookshelf > )
13- . add_observer ( setup_static_prop_with_convex_hull :: < Generator2 > )
14- . add_observer ( setup_static_prop_with_convex_hull :: < BarrelLargeClosed > )
15- . add_observer ( setup_static_prop_with_convex_hull :: < Barrel01 > )
16- . add_observer ( setup_static_prop_with_convex_hull :: < CrateSquare > )
17- . add_observer ( setup_static_prop_with_convex_hull :: < FenceBarsDecorativeSingle > )
18- . add_observer ( setup_static_prop_with_convex_hull :: < DoorStainedGlass > ) ;
19-
20- app. add_observer ( setup_dynamic_prop_with_convex_hull :: < PackageMedium > )
21- . add_observer ( setup_dynamic_prop_with_convex_hull :: < PackageSmall > ) ;
22-
23- app. add_observer ( setup_nonphysical_prop :: < IvyPart8 > )
24- . add_observer ( setup_nonphysical_prop :: < SmallDoorSign1 > ) ;
25-
269 app. load_asset :: < Gltf > ( PackageMedium :: model_path ( ) )
2710 . load_asset :: < Gltf > ( PackageSmall :: model_path ( ) )
2811 . load_asset :: < Gltf > ( Grate :: model_path ( ) )
@@ -44,67 +27,78 @@ pub(super) fn plugin(app: &mut App) {
4427 base( Transform , Visibility ) ,
4528 model( "models/darkmod/containers/package_medium.gltf" )
4629) ]
30+ #[ component( on_add = setup_prop:: <PackageMedium >( RigidBody :: Dynamic , ColliderConstructor :: ConvexHullFromMesh ) ) ]
4731pub ( crate ) struct PackageMedium ;
4832
4933#[ point_class(
5034 base( Transform , Visibility ) ,
5135 model( "models/darkmod/containers/package_small.gltf" )
5236) ]
37+ #[ component( on_add = setup_prop:: <PackageSmall >( RigidBody :: Dynamic , ColliderConstructor :: ConvexHullFromMesh ) ) ]
5338pub ( crate ) struct PackageSmall ;
5439
5540// generic static props
5641#[ point_class(
5742 base( Transform , Visibility ) ,
5843 model( "models/darkmod/fireplace/grate.gltf" )
5944) ]
45+ #[ component( on_add = setup_prop:: <Grate >( RigidBody :: Static , ColliderConstructor :: ConvexHullFromMesh ) ) ]
6046pub ( crate ) struct Grate ;
6147
6248#[ point_class(
6349 base( Transform , Visibility ) ,
6450 model( "models/darkmod/furniture/tables/rtable1.gltf" )
6551) ]
52+ #[ component( on_add = setup_prop:: <Table >( RigidBody :: Static , ColliderConstructor :: ConvexDecompositionFromMesh ) ) ]
6653pub ( crate ) struct Table ;
6754
6855#[ point_class(
6956 base( Transform , Visibility ) ,
7057 model( "models/darkmod/furniture/shelves/bookshelf02.gltf" )
7158) ]
59+ #[ component( on_add = setup_prop:: <Bookshelf >( RigidBody :: Static , ColliderConstructor :: ConvexHullFromMesh ) ) ]
7260pub ( crate ) struct Bookshelf ;
7361
7462#[ point_class(
7563 base( Transform , Visibility ) ,
7664 model( "models/darkmod/mechanical/generator2/generator2.gltf" )
7765) ]
66+ #[ component( on_add = setup_prop:: <Generator2 >( RigidBody :: Static , ColliderConstructor :: ConvexHullFromMesh ) ) ]
7867pub ( crate ) struct Generator2 ;
7968
8069#[ point_class(
8170 base( Transform , Visibility ) ,
8271 model( "models/darkmod/containers/barrel_large_closed.gltf" )
8372) ]
73+ #[ component( on_add = setup_prop:: <BarrelLargeClosed >( RigidBody :: Static , ColliderConstructor :: ConvexHullFromMesh ) ) ]
8474pub ( crate ) struct BarrelLargeClosed ;
8575
8676#[ point_class(
8777 base( Transform , Visibility ) ,
8878 model( "models/darkmod/containers/barrel01.gltf" )
8979) ]
80+ #[ component( on_add = setup_prop:: <Barrel01 >( RigidBody :: Static , ColliderConstructor :: ConvexHullFromMesh ) ) ]
9081pub ( crate ) struct Barrel01 ;
9182
9283#[ point_class(
9384 base( Transform , Visibility ) ,
9485 model( "models/darkmod/containers/crate_square.gltf" )
9586) ]
87+ #[ component( on_add = setup_prop:: <CrateSquare >( RigidBody :: Static , ColliderConstructor :: ConvexHullFromMesh ) ) ]
9688pub ( crate ) struct CrateSquare ;
9789
9890#[ point_class(
9991 base( Transform , Visibility ) ,
10092 model( "models/darkmod/architecture/fencing/fence_bars_decorative01_single.gltf" )
10193) ]
94+ #[ component( on_add = setup_prop:: <FenceBarsDecorativeSingle >( RigidBody :: Static , ColliderConstructor :: ConvexHullFromMesh ) ) ]
10295pub ( crate ) struct FenceBarsDecorativeSingle ;
10396
10497#[ point_class(
10598 base( Transform , Visibility ) ,
10699 model( "models/darkmod/architecture/doors/door_stained_glass_118x52.gltf" )
107100) ]
101+ #[ component( on_add = setup_prop:: <DoorStainedGlass >( RigidBody :: Static , ColliderConstructor :: ConvexHullFromMesh ) ) ]
108102pub ( crate ) struct DoorStainedGlass ;
109103
110104// Generic non-physical props
@@ -113,10 +107,12 @@ pub(crate) struct DoorStainedGlass;
113107 base( Transform , Visibility ) ,
114108 model( "models/darkmod/nature/ivy_part08.gltf" )
115109) ]
110+ #[ component( on_add = setup_nonphysical_prop:: <IvyPart8 >) ]
116111pub ( crate ) struct IvyPart8 ;
117112
118113#[ point_class(
119114 base( Transform , Visibility ) ,
120115 model( "models/darkmod/decorative/signs/small_door_sign1.gltf" )
121116) ]
117+ #[ component( on_add = setup_nonphysical_prop:: <SmallDoorSign1 >) ]
122118pub ( crate ) struct SmallDoorSign1 ;
0 commit comments