(autoformat)
This commit is contained in:
@@ -117,19 +117,21 @@ fn do_scan(
|
|||||||
match select_mode {
|
match select_mode {
|
||||||
SelectionMode::NearestSingle => todo!(),
|
SelectionMode::NearestSingle => todo!(),
|
||||||
SelectionMode::CircularArea => {
|
SelectionMode::CircularArea => {
|
||||||
let boids = spatial.shape_intersections(
|
let boids = spatial
|
||||||
&Collider::circle(SCANRADIUS),
|
.shape_intersections(
|
||||||
cursor_pos.translation.xy(),
|
&Collider::circle(SCANRADIUS),
|
||||||
0.0,
|
cursor_pos.translation.xy(),
|
||||||
&SpatialQueryFilter::default()
|
0.0,
|
||||||
).into_iter()
|
&SpatialQueryFilter::default(),
|
||||||
|
)
|
||||||
|
.into_iter()
|
||||||
.map(|entt| {
|
.map(|entt| {
|
||||||
let (tsfm, vel, _) = boids_query
|
let (tsfm, vel, _) = boids_query
|
||||||
.get(entt)
|
.get(entt)
|
||||||
.expect("Debugger scanned a Boid missing one of it's components!");
|
.expect("Debugger scanned a Boid missing one of it's components!");
|
||||||
(tsfm, vel)
|
(tsfm, vel)
|
||||||
});
|
});
|
||||||
|
|
||||||
match scan_mode {
|
match scan_mode {
|
||||||
ScannerMode::CenterOfMass => {
|
ScannerMode::CenterOfMass => {
|
||||||
if let Some(center_mass) = center_of_boids(
|
if let Some(center_mass) = center_of_boids(
|
||||||
@@ -141,9 +143,9 @@ fn do_scan(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ScannerMode::Velocity => {
|
ScannerMode::Velocity => {
|
||||||
if let Some(avg_velocity) = velocity_of_boids(boids.map(|item| {
|
if let Some(avg_velocity) =
|
||||||
(*item.1).xy() * 1.0
|
velocity_of_boids(boids.map(|item| (*item.1).xy() * 1.0))
|
||||||
})) {
|
{
|
||||||
// cursor_pos.translation is already in world space, so I can skip the window -> world transform like in update_cursor()
|
// cursor_pos.translation is already in world space, so I can skip the window -> world transform like in update_cursor()
|
||||||
gizmos.line_2d(
|
gizmos.line_2d(
|
||||||
cursor_pos.translation.xy(),
|
cursor_pos.translation.xy(),
|
||||||
|
|||||||
Reference in New Issue
Block a user