Create an early scripting engine #2
|
@ -55,9 +55,9 @@ pub fn free_fly_camera_controller(delta_time: Res<DeltaTime>, handler: Res<Actio
|
||||||
let left = cam.transform.left();
|
let left = cam.transform.left();
|
||||||
let up = Vec3::Y;
|
let up = Vec3::Y;
|
||||||
|
|
||||||
let move_y = handler.get_axis_modifier(CommonActionLabel::MoveUpDown).unwrap_or(0.0);
|
let move_y = handler.get_axis_modifier("MoveUpDown").unwrap_or(0.0);
|
||||||
let move_x = handler.get_axis_modifier(CommonActionLabel::MoveLeftRight).unwrap_or(0.0);
|
let move_x = handler.get_axis_modifier("MoveLeftRight").unwrap_or(0.0);
|
||||||
let move_z = handler.get_axis_modifier(CommonActionLabel::MoveForwardBackward).unwrap_or(0.0);
|
let move_z = handler.get_axis_modifier("MoveForwardBackward").unwrap_or(0.0);
|
||||||
|
|
||||||
let mut velocity = Vec3::ZERO;
|
let mut velocity = Vec3::ZERO;
|
||||||
velocity += move_y * up;
|
velocity += move_y * up;
|
||||||
|
@ -68,9 +68,9 @@ pub fn free_fly_camera_controller(delta_time: Res<DeltaTime>, handler: Res<Actio
|
||||||
cam.transform.translation += velocity.normalize() * fly.speed * delta_time; // TODO: speeding up
|
cam.transform.translation += velocity.normalize() * fly.speed * delta_time; // TODO: speeding up
|
||||||
}
|
}
|
||||||
|
|
||||||
let motion_x = handler.get_axis_modifier(CommonActionLabel::LookLeftRight).unwrap_or(0.0);
|
let motion_x = handler.get_axis_modifier("LookLeftRight").unwrap_or(0.0);
|
||||||
let motion_y = handler.get_axis_modifier(CommonActionLabel::LookUpDown).unwrap_or(0.0);
|
let motion_y = handler.get_axis_modifier("LookUpDown").unwrap_or(0.0);
|
||||||
let motion_z = handler.get_axis_modifier(CommonActionLabel::LookRoll).unwrap_or(0.0);
|
let motion_z = handler.get_axis_modifier("LookRoll").unwrap_or(0.0);
|
||||||
|
|
||||||
let mut camera_rot = Vec3::ZERO;
|
let mut camera_rot = Vec3::ZERO;
|
||||||
camera_rot.y -= motion_x * fly.mouse_sensitivity;
|
camera_rot.y -= motion_x * fly.mouse_sensitivity;
|
||||||
|
|
|
@ -283,8 +283,8 @@ async fn main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
let world = game.world_mut();
|
let world = game.world_mut();
|
||||||
world.add_resource(action_handler);
|
world.add_resource(action_handler); */
|
||||||
game.with_plugin(InputActionPlugin); */
|
game.with_plugin(InputActionPlugin);
|
||||||
};
|
};
|
||||||
|
|
||||||
let script_test_plugin = |game: &mut Game| {
|
let script_test_plugin = |game: &mut Game| {
|
||||||
|
@ -309,6 +309,6 @@ async fn main() {
|
||||||
.with_plugin(script_test_plugin)
|
.with_plugin(script_test_plugin)
|
||||||
//.with_plugin(fps_plugin)
|
//.with_plugin(fps_plugin)
|
||||||
.with_plugin(jiggle_plugin)
|
.with_plugin(jiggle_plugin)
|
||||||
//.with_plugin(FreeFlyCameraPlugin)
|
.with_plugin(FreeFlyCameraPlugin)
|
||||||
.run().await;
|
.run().await;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue