-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: ForesightMiningSoftwareCorporation#8 2d axis only
- Loading branch information
Showing
4 changed files
with
168 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
use bevy::prelude::*; | ||
|
||
fn main() { | ||
App::new() | ||
.insert_resource(WindowDescriptor { | ||
vsync: false, // Disabled for this demo to remove vsync as a source of input latency | ||
..Default::default() | ||
}) | ||
.add_plugins(DefaultPlugins) | ||
.add_plugins(bevy_mod_picking::DefaultPickingPlugins) | ||
.add_plugin(bevy_transform_gizmo::TransformGizmoPlugin::new( | ||
Quat::default(), | ||
bevy_transform_gizmo::GizmoAxisModeValue::XY, | ||
)) | ||
.add_startup_system(setup) | ||
.run(); | ||
} | ||
|
||
/// set up a simple 2D scene | ||
fn setup( | ||
mut commands: Commands, | ||
mut meshes: ResMut<Assets<Mesh>>, | ||
mut materials: ResMut<Assets<StandardMaterial>>, | ||
) { | ||
commands.insert_resource(bevy_transform_gizmo::GizmoAxisMode { | ||
mode: bevy_transform_gizmo::GizmoAxisModeValue::XY, | ||
}); | ||
// plane | ||
commands | ||
.spawn_bundle(PbrBundle { | ||
mesh: meshes.add(Mesh::from(shape::Plane { size: 5.0 })), | ||
material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), | ||
..Default::default() | ||
}) | ||
.insert_bundle(bevy_mod_picking::PickableBundle::default()) | ||
.insert(bevy_transform_gizmo::GizmoTransformable); | ||
// cube | ||
commands | ||
.spawn_bundle(PbrBundle { | ||
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })), | ||
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()), | ||
transform: Transform::from_xyz(0.0, 0.5, 0.0), | ||
..Default::default() | ||
}) | ||
.insert_bundle(bevy_mod_picking::PickableBundle::default()) | ||
.insert(bevy_transform_gizmo::GizmoTransformable); | ||
// light | ||
commands.spawn_bundle(PointLightBundle { | ||
transform: Transform::from_xyz(4.0, 8.0, 4.0), | ||
..Default::default() | ||
}); | ||
// camera | ||
commands | ||
.spawn_bundle(PerspectiveCameraBundle { | ||
transform: Transform::from_xyz(2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y), | ||
..Default::default() | ||
}) | ||
.insert_bundle(bevy_mod_picking::PickingCameraBundle::default()) | ||
.insert(bevy_transform_gizmo::GizmoPickSource::default()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters