Pretty much what the title says.
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(
WindowPlugin {
primary_window: Some(Window {
title: "NEA".into(),
mode: bevy:🪟:WindowMode::Windowed,
position: bevy:🪟:WindowPosition::At((-15,0).into()),
resolution: (1600.0,922.0).into(),
..Default::default()
}),
..Default::default()
}
).set(ImagePlugin::default_nearest()))
.add_systems(Startup, VerletObject::setup)
.run();
}
#[derive(Component)]
struct Shape;
struct VerletObject {
position_current: Vec2,
position_old: Vec2,
acceleration: Vec2,
}
impl VerletObject {
fn setup(
&mut self,
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
commands.spawn((
PbrBundle {
mesh: meshes.add(shape::UVSphere::default().into()),
material: materials.add(Color::rgb(0.0, 1.0, 0.5).into()),
transform: Transform::from_xyz(
self.position_current[0].into(),
self.position_current[1].into(),
4.0,
),
..default()
},
Shape,
));
commands.spawn(PointLightBundle {
point_light: PointLight {
intensity: 9000.0,
range: 100.,
shadows_enabled: false,
..default()
},
transform: Transform::from_xyz(8.0, 16.0, 8.0),
..default()
});
commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(0.0, 6., 12.0).looking_at(Vec3::new(0., 1., 0.), Vec3::Y),
..default()
});
}