This commit is contained in:
LorrensP-2158466
2025-04-05 23:52:25 +02:00
parent 153a40cb73
commit be1caf37c1
6 changed files with 6501 additions and 38 deletions

View File

@@ -1,4 +1,5 @@
use bevy::prelude::*;
use bevy::{gltf::GltfMesh, math::Vec3A, prelude::*, render::mesh::MeshAabb};
use bevy_rapier3d::prelude::{Collider, RigidBody};
use crate::{GameState, asset_loading::GltfAssets};
@@ -18,11 +19,22 @@ fn spawn(mut commands: Commands, models: Res<Assets<Gltf>>, gltf_assets: Res<Glt
let hammer = models.get(hammer).unwrap();
let asset = hammer.default_scene.as_ref().unwrap();
// hammer
commands.spawn((
Transform::from_xyz(0.0, 1.0, 0.0).with_scale(Vec3::splat(0.1)),
Interact,
SceneRoot(asset.clone()),
));
commands
.spawn((
Transform::from_xyz(0.0, 100.0, 0.0).with_scale(Vec3::splat(0.1)),
Interact,
RigidBody::Dynamic,
SceneRoot(asset.clone()),
))
.with_children(|parent| {
parent
.spawn(Collider::cuboid(0.8, 10f32, 0.8))
.insert(Transform::from_xyz(0.0, -5.0, 0.0));
parent
.spawn(Collider::cuboid(1.0, 1.0, 4.5))
// Position the collider relative to the rigid-body.
.insert(Transform::from_xyz(0.0, 4.2, 1.0));
});
//tools
}