add orbit command

This commit is contained in:
yuni 2024-04-02 01:06:33 +02:00
parent ab14610ea4
commit 53dceeb6aa

View file

@ -227,6 +227,20 @@ pub fn load_defs(
} }
} }
} }
["orbit", radius_str, phase_str] => {
if let (Ok(r), Ok(phase)) = (radius_str.parse::<f64>(), phase_str.parse::<f64>()) {
let phase_deg = phase * PI64 * 2.0;
state.pos = DVec3::new(
state.pos.x + r * phase_deg.cos(),
state.pos.y,
state.pos.z + r * phase_deg.sin(),
);
}
else {
error!("Can't parse float: {line}");
continue;
}
}
["sphere", "yes"] => { ["sphere", "yes"] => {
state.is_sphere = true; state.is_sphere = true;
} }