beginning of interaction
This commit is contained in:
28
src/interaction/objects.rs
Normal file
28
src/interaction/objects.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::{GameState, asset_loading::GltfAssets};
|
||||
|
||||
pub fn plugin(app: &mut App) {
|
||||
app.add_systems(OnEnter(GameState::Playing), spawn);
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Interact;
|
||||
|
||||
fn spawn(mut commands: Commands, models: Res<Assets<Gltf>>, gltf_assets: Res<GltfAssets>) {
|
||||
let hammer = gltf_assets
|
||||
.library
|
||||
.get("meshes/library/hammer.glb")
|
||||
.unwrap();
|
||||
|
||||
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()),
|
||||
));
|
||||
|
||||
//tools
|
||||
}
|
||||
Reference in New Issue
Block a user