Thanks I couldn't understand your exact instructions but, I did work something out based on it. reason I was confused is that t is based on r and had a kind of circular dependency so incrementing that value would break things, I added length and dist idea is length was count and `dist was parameter
fn setup_galaxy_view(
mut commands: Commands,
star_query: Query<(&StellarSystemID, &DisplayName), With<Star>>,
asset_server: Res<AssetServer>,
) {
//snip
let a = 1.01; // Controls the distance between spiral arms
let b = 12.0f32.to_radians(); // Controls how tightly the spiral is wound
info!("galaxy start {}", star_query.iter().count());
let mut length = 30.0;
let dist = 5.0;
let star_gltf = asset_server.load(GltfAssetLabel::Scene(0).from_asset("galaxy/GStar.glb"));
for (i, (solar_id, name)) in star_query.iter().enumerate() {
trace!("galaxies");
let i = 1.0 + i as f32;
let t = i as f32 * 0.382;
let r = a * (b * t).exp();
length += t / dist;
let x = length * t.cos();
let z = length * t.sin();
// let x = x.sqrt();
// let z = z.sqrt();
trace!(?x, ?z, ?r, ?t, ?a, ?b);
commands
.spawn((
SceneBundle {
scene: star_gltf.clone(),
visibility: Visibility::Hidden,
transform: Transform::from_xyz(x, 0.0, z),
..Default::default()
},
On::<Pointer<Down>>::send_event::<StellaMove>(),
*solar_id,
GalaticViewStar,
))
//snip
}
}```