wip character controller
This commit is contained in:
@@ -7,9 +7,10 @@ use bevy::{
|
||||
use crate::{
|
||||
components::{
|
||||
camera::{CameraPitch, CameraRoot, FollowCam, MainCamera, Unfocused},
|
||||
tags::Ship,
|
||||
character_controller::CharacterController,
|
||||
tags::{Player, Ship},
|
||||
},
|
||||
plugins::{follow_cam::FollowCamPlugin, free_cam::FreeCamPlugin, ship::ShipPlugin, types::TypesPlugin},
|
||||
plugins::*,
|
||||
};
|
||||
// use bevy_rapier3d::prelude::*;
|
||||
|
||||
@@ -18,7 +19,7 @@ pub struct GamePlugin;
|
||||
|
||||
impl Plugin for GamePlugin {
|
||||
fn build(&self, app: &mut bevy::app::App) {
|
||||
app.add_plugins((FollowCamPlugin, ShipPlugin, TypesPlugin));
|
||||
app.add_plugins((FollowCamPlugin, ShipPlugin, TypesPlugin, CharacterControllerPlugin));
|
||||
app.add_plugins((
|
||||
PhysicsPlugins::default(),
|
||||
#[cfg(feature = "dev-phys")]
|
||||
@@ -36,10 +37,22 @@ fn setup_scene(
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
mut window: Single<&mut Window, With<PrimaryWindow>>,
|
||||
mut gravity: ResMut<Gravity>,
|
||||
) {
|
||||
gravity.0 = Vec3::ZERO;
|
||||
|
||||
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)),
|
||||
));
|
||||
|
||||
commands.spawn((
|
||||
Name::new("Camera Root"),
|
||||
Transform::from_xyz(0.0, 1.3, 0.0),
|
||||
|
||||
Reference in New Issue
Block a user