add orbit command
This commit is contained in:
parent
ab14610ea4
commit
53dceeb6aa
|
@ -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"] => {
|
||||
state.is_sphere = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue