Initial work on proper character movement

This commit is contained in:
2026-08-24 18:24:20 +02:00
parent a21f24b2d9
commit 91c5c4e05f
30 changed files with 1221 additions and 347 deletions
+26 -14
View File
@@ -1,37 +1,49 @@
//! The scene content that gets spawned at startup.
use bevy::prelude::*;
use std::f32::consts::PI;
use crate::stage::StageLine;
use bevy::{camera_controller::free_camera::FreeCamera, prelude::*};
use crate::stage::{StagePoly, line::StagePolyLineSegmentType, line::StageCollision};
/// set up a simple 3D scene
pub fn test_scene() -> impl SceneList {
let stage_poly = StagePoly::build(crate::stage::line::StagePolyType::Closed, &[
(Vec2::new(-5.6, -0.35), StagePolyLineSegmentType::Floor),
(Vec2::new(-3.92, 0.0), StagePolyLineSegmentType::Floor),
(Vec2::new(0.0, 0.0), StagePolyLineSegmentType::Floor),
(Vec2::new(3.92, 0.0), StagePolyLineSegmentType::Floor),
(Vec2::new(5.6, -0.35), StagePolyLineSegmentType::Wall),
(Vec2::new(5.6, -20.0), StagePolyLineSegmentType::Ceiling),
(Vec2::new(-5.6, -20.0), StagePolyLineSegmentType::Wall)
]);
bsn_list! [
(
#Cube
Mesh3d(asset_value(Cuboid::new(5.0, 1.0, 1.0)))
MeshMaterial3d::<StandardMaterial>(asset_value(Color::srgb_u8(124, 144, 255)))
Transform::from_xyz(0.0, 0.5, 0.0)
#StageCollision
template_value(StageCollision {
stage_polys: vec!(stage_poly)
})
),
(
#StagePlane
template_value(StageLine::new(Vec2::new(-2.5, 1.0), Vec2::new(2.5, 1.0)).unwrap())
),
(
PointLight {
DirectionalLight {
shadow_maps_enabled: true,
}
Transform::from_xyz(4.0, 8.0, 4.0)
Transform {
translation: Vec3::new(0.0, 2.0, 0.0),
rotation: Quat::from_rotation_x(-PI / 4.),
}
),
(
Camera3d
template_value(Transform::from_xyz(0.0, 1.5, 9.0))
/*FreeCamera {
FreeCamera {
sensitivity: 0.2,
friction: 25.0,
walk_speed: 3.0,
run_speed: 9.0,
}*/
}
)
]
}