diff --git a/docs/devlog/v0.2.0.md b/docs/devlog/v0.2.0.md index 1a6c8fe..0a27b90 100644 --- a/docs/devlog/v0.2.0.md +++ b/docs/devlog/v0.2.0.md @@ -58,3 +58,12 @@ Verdict: **[egui](https://www.egui.rs/) now, [lunex](https://bytestring-net.gith - Made a basic UI with egui - Added basic entity spawner - Added [todo.md](../todo.md) + +# 2024-08-06 + +ChatGPT read https://arxiv.org/abs/2402.11150 and my time dilation notes and +affirmed that I have a correct understanding and my math is mostly right. The +suspicious deviation of my results from wikipedia's results is a units error. +Wikipedia uses microseconds per day, but I show microseconds per second. + +ChatGPT helped me make a stupid-simple demo to get started with time dilation. diff --git a/src/physics/mod.rs b/src/physics/mod.rs index 48c46c0..90d0d5d 100644 --- a/src/physics/mod.rs +++ b/src/physics/mod.rs @@ -1,8 +1,13 @@ +mod time_dilation; + use avian2d::prelude::*; use bevy::prelude::*; pub(super) fn plugin(app: &mut App) { - app.add_plugins(PhysicsPlugins::default().with_length_unit(1.0)); + app.add_plugins(( + PhysicsPlugins::default().with_length_unit(1.0), + time_dilation::plugin, + )); // we will handle gravity ourselves app.insert_resource(Gravity(Vec2::ZERO.into())); diff --git a/src/physics/time_dilation.rs b/src/physics/time_dilation.rs new file mode 100644 index 0000000..3a333d9 --- /dev/null +++ b/src/physics/time_dilation.rs @@ -0,0 +1,46 @@ +use bevy::prelude::*; +use bevy_egui::{egui, EguiContexts}; + +pub(super) fn plugin(app: &mut App) { + app.add_systems(Startup, setup); + app.add_systems(Update, (update_time_dilation, update_ui)); +} + +#[derive(Component)] +struct TimeDilation { + proper_time: f32, + coordinate_time: f32, + velocity: f32, // Fraction of the speed of light +} + +fn setup( + mut commands: Commands, +) { + commands.spawn(TimeDilation { + proper_time: 0.0, + coordinate_time: 0.0, + velocity: 0.1, // Example value for v/c + }); +} + +fn update_time_dilation(mut query: Query<&mut TimeDilation>, time: Res