1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
use crate::solar_system::{Kilograms, Kilometers, SolarSystem, body::BodyId, orbit::StaticOrbit};
pub type ShipId = usize;
pub struct Ship
{
name: String,
mass: Kilograms,
position: cgmath::Vector3<Kilometers>,
velocity: cgmath::Vector3<f32>,
acceleration: cgmath::Vector3<f32>,
baked_orbit: Option<StaticOrbit>
}
impl Ship
{
pub fn new(
name: String,
mass: Kilograms,
system: &SolarSystem,
orbiting: BodyId,
orbit_sma: Kilometers)
-> Self
{
Self {
name,
mass,
position: cgmath::vec3(0.0, 0.0, 0.0),
velocity: cgmath::vec3(0.0, 0.0, 0.0),
acceleration: cgmath::vec3(0.0, 0.0, 0.0),
baked_orbit: None
}
}
}
|