mirror of
https://codeberg.org/schrottkatze/mgd2-tram-championships.git
synced 2025-07-04 11:07:40 +00:00
Compare commits
No commits in common. "cf63dd6e41e4970c0e73b80e36d6f4302b6856f0" and "684fdd5558aab2c2b112e2961e3c0d5e233ba849" have entirely different histories.
cf63dd6e41
...
684fdd5558
15 changed files with 123 additions and 476 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,3 @@
|
||||||
/target
|
/target
|
||||||
/.direnv
|
/.direnv
|
||||||
*.blend1
|
|
||||||
|
|
546
Cargo.lock
generated
546
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -2,15 +2,13 @@
|
||||||
name = "mgd2-demonic-posession"
|
name = "mgd2-demonic-posession"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
default-run = "mgd2-demonic-posession"
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = {version="0.16.1", features=["file_watcher"]}
|
bevy = "0.16.0"
|
||||||
bevy-inspector-egui = "0.31.0"
|
bevy-inspector-egui = "0.31.0"
|
||||||
bevy_third_person_camera = "0.3.0"
|
bevy_third_person_camera = "0.3.0"
|
||||||
env_logger = "0.11.8"
|
env_logger = "0.11.8"
|
||||||
log = "0.4.27"
|
log = "0.4.27"
|
||||||
bevy_skein = { git = "https://github.com/rust-adventure/skein.git" }
|
|
||||||
|
|
||||||
# Enable a small amount of optimization in the dev profile.
|
# Enable a small amount of optimization in the dev profile.
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -3,7 +3,7 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_third_person_camera::*;
|
use bevy_third_person_camera::*;
|
||||||
|
|
||||||
use crate::{AppState, TPCTarget};
|
use crate::AppState;
|
||||||
|
|
||||||
use super::GameplaySet;
|
use super::GameplaySet;
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ pub fn plugin(app: &mut App) {
|
||||||
OnEnter(AppState::Ingame),
|
OnEnter(AppState::Ingame),
|
||||||
setup_game_camera.in_set(GameplaySet),
|
setup_game_camera.in_set(GameplaySet),
|
||||||
)
|
)
|
||||||
// .add_systems(Update, auto_target)
|
|
||||||
.add_systems(OnExit(AppState::Ingame), remove_tpc.in_set(GameplaySet));
|
.add_systems(OnExit(AppState::Ingame), remove_tpc.in_set(GameplaySet));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,21 +39,6 @@ pub fn setup_game_camera(mut c: Commands, cam: Single<Entity, With<Camera3d>>) {
|
||||||
info!("Third person camera set up!")
|
info!("Third person camera set up!")
|
||||||
}
|
}
|
||||||
|
|
||||||
// fn auto_target(
|
|
||||||
// mut c: Commands,
|
|
||||||
// without_custom: Query<Entity, (With<ThirdPersonCameraTarget>, Without<TPCTarget>)>,
|
|
||||||
// without_lib: Query<Entity, (Without<ThirdPersonCameraTarget>, With<TPCTarget>)>,
|
|
||||||
// ) {
|
|
||||||
// without_custom.iter().for_each(|e| {
|
|
||||||
// info!("Deleting ThirdPersonCameraTarget from {e}");
|
|
||||||
// c.entity(e).remove::<ThirdPersonCameraTarget>();
|
|
||||||
// });
|
|
||||||
// without_lib.iter().for_each(|e| {
|
|
||||||
// info!("Inserting TPCTarget into {e}");
|
|
||||||
// c.entity(e).insert(ThirdPersonCameraTarget);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
/// Removes [ThirdPersonCamera] from the camera.
|
/// Removes [ThirdPersonCamera] from the camera.
|
||||||
pub fn remove_tpc(mut c: Commands, cam: Single<Entity, (With<Camera3d>, With<ThirdPersonCamera>)>) {
|
pub fn remove_tpc(mut c: Commands, cam: Single<Entity, (With<Camera3d>, With<ThirdPersonCamera>)>) {
|
||||||
c.entity(*cam).remove::<ThirdPersonCamera>();
|
c.entity(*cam).remove::<ThirdPersonCamera>();
|
||||||
|
|
|
@ -3,19 +3,26 @@ use bevy_third_person_camera::ThirdPersonCameraTarget;
|
||||||
|
|
||||||
use crate::cleanup;
|
use crate::cleanup;
|
||||||
|
|
||||||
|
const NORMALSPUR: f32 = 1.435;
|
||||||
|
|
||||||
pub fn setup(
|
pub fn setup(
|
||||||
mut c: Commands,
|
mut c: Commands,
|
||||||
asset_server: Res<AssetServer>,
|
|
||||||
mut meshes: ResMut<Assets<Mesh>>,
|
mut meshes: ResMut<Assets<Mesh>>,
|
||||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||||
) {
|
) {
|
||||||
let scene_handle = asset_server.load(GltfAssetLabel::Scene(0).from_asset("gltf/test.glb"));
|
// spawn in floor plane
|
||||||
c.spawn((
|
c.spawn((
|
||||||
Mesh3d(meshes.add(Cuboid::new(1., 1., 1.))),
|
Mesh3d(meshes.add(Plane3d::default().mesh().size(128., 128.))),
|
||||||
|
MeshMaterial3d(materials.add(Color::srgb(0.3, 0.8, 0.4))),
|
||||||
|
cleanup::Scene,
|
||||||
|
));
|
||||||
|
|
||||||
|
// track (temporary)
|
||||||
|
c.spawn((
|
||||||
|
Mesh3d(meshes.add(Cuboid::new(NORMALSPUR, 0.25, 96.))),
|
||||||
MeshMaterial3d(materials.add(Color::BLACK)),
|
MeshMaterial3d(materials.add(Color::BLACK)),
|
||||||
ThirdPersonCameraTarget,
|
ThirdPersonCameraTarget,
|
||||||
cleanup::Scene,
|
cleanup::Scene,
|
||||||
));
|
));
|
||||||
c.spawn(SceneRoot(scene_handle));
|
|
||||||
info!("Scene spawned!")
|
info!("Scene spawned!")
|
||||||
}
|
}
|
||||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -1,6 +1,5 @@
|
||||||
#![feature(iter_collect_into)]
|
#![feature(iter_collect_into)]
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_skein::SkeinPlugin;
|
|
||||||
|
|
||||||
mod camera;
|
mod camera;
|
||||||
mod cleanup;
|
mod cleanup;
|
||||||
|
@ -19,16 +18,13 @@ enum AppState {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
.register_type::<TPCTarget>()
|
|
||||||
.add_systems(Startup, camera::setup)
|
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
.add_plugins((game::plugin, menus::plugin, debugging::plugin))
|
.add_systems(Startup, camera::setup)
|
||||||
.add_plugins(SkeinPlugin::default())
|
.add_plugins(game::plugin)
|
||||||
|
.add_plugins(menus::plugin)
|
||||||
.init_state::<AppState>()
|
.init_state::<AppState>()
|
||||||
|
.add_plugins(debugging::plugin)
|
||||||
.register_type::<AppState>()
|
.register_type::<AppState>()
|
||||||
|
// .insert_state(AppState::Ingame)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Reflect, Component)]
|
|
||||||
#[reflect(Component)]
|
|
||||||
struct TPCTarget;
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue