testing
This commit is contained in:
@@ -19,14 +19,20 @@ pub struct GamePlugin;
|
||||
|
||||
impl Plugin for GamePlugin {
|
||||
fn build(&self, app: &mut bevy::app::App) {
|
||||
app.add_plugins((FollowCamPlugin, ShipPlugin, TypesPlugin, CharacterControllerPlugin));
|
||||
app.add_plugins((
|
||||
FollowCamPlugin,
|
||||
// ShipPlugin,
|
||||
TypesPlugin,
|
||||
PlayerPlugin,
|
||||
CharacterControllerPlugin,
|
||||
));
|
||||
app.add_plugins((
|
||||
PhysicsPlugins::default(),
|
||||
#[cfg(feature = "dev-phys")]
|
||||
PhysicsDebugPlugin::default(),
|
||||
));
|
||||
app.insert_resource(Gravity::ZERO);
|
||||
app.add_systems(Startup, (setup_scene, spawn_ship).chain());
|
||||
app.add_systems(Startup, (setup_scene).chain());
|
||||
|
||||
app.add_systems(Update, camera_toggle);
|
||||
}
|
||||
@@ -41,23 +47,30 @@ fn setup_scene(
|
||||
) {
|
||||
gravity.0 = Vec3::ZERO;
|
||||
|
||||
window.cursor_options.visible = false;
|
||||
window.cursor_options.grab_mode = CursorGrabMode::Locked;
|
||||
// window.cursor_options.visible = false;
|
||||
// window.cursor_options.grab_mode = CursorGrabMode::Locked;
|
||||
|
||||
commands.spawn((
|
||||
Name::new("Player"),
|
||||
CharacterController::default(),
|
||||
Player,
|
||||
Mesh3d(meshes.add(Capsule3d::new(0.5, 1.0))),
|
||||
MeshMaterial3d(materials.add(Color::linear_rgb(1.0, 0.0, 0.2))),
|
||||
Transform::from_translation(Vec3::new(0.0, 10.0, 0.0)),
|
||||
));
|
||||
let player = commands
|
||||
.spawn((
|
||||
Name::new("Player"),
|
||||
CharacterController::default(),
|
||||
Player,
|
||||
Mesh3d(meshes.add(Capsule3d::new(0.5, 1.0))),
|
||||
MeshMaterial3d(materials.add(Color::linear_rgb(1.0, 0.0, 0.2))),
|
||||
Transform::from_translation(Vec3::new(0.0, 10.0, 10.0)),
|
||||
))
|
||||
.id();
|
||||
|
||||
commands.spawn((
|
||||
Name::new("Camera Root"),
|
||||
Transform::from_xyz(0.0, 1.3, 0.0),
|
||||
CameraRoot,
|
||||
Visibility::default(),
|
||||
FollowCam {
|
||||
distance: 20.,
|
||||
height: 10.,
|
||||
target: player,
|
||||
},
|
||||
children![(
|
||||
Camera3d::default(),
|
||||
CameraPitch::default(),
|
||||
|
||||
Reference in New Issue
Block a user