Commit Graph

15 Commits

Author SHA1 Message Date
ccd8a12b79 Autoformat 2025-09-03 14:27:28 -05:00
3eb23fb4bf Move physics parts to a physics module 2025-09-03 12:23:53 -05:00
4150f85ccc Rename & restructure birdoids module
The module isn't the plugin, so it's going to be called simply
"birdoids" going forward.

I've turned it into a folder and a `mod.rs` so I can slap down a small,
custom physics system.
2025-08-30 15:39:41 -05:00
214da65db5 Switch off deprecated functions, fix clippy lints 2025-08-30 15:39:41 -05:00
325e515a7b Autoformat 2025-08-30 15:39:41 -05:00
e85114c4c8 Adjust code for Bevy 0.14 -> 0.16 upgrade
Now the program builds again.
2025-08-30 15:39:41 -05:00
b75c05940d Run cargo fmt before merging branch 2024-07-16 09:31:15 -05:00
18885d9b94 Rename Acceleration to Force
Closes #2

Acceleration is mass * force.
This doesn't materially change anything, but it will make it easier to
give the boids a mass component. The change will not require updates to
most of the systems, only the physics integrator and the boids bundle.
2024-07-12 16:47:27 -05:00
f9ce96bbce cargo fmt again 2024-07-12 10:00:27 -05:00
bb33fda018 Fix: spatial tree update frequency is too low
The reubild frequency of the spatial tree was causing calculations to
operate on old information. This is not the intended behavior. The
default schedule seems to be to run every frame.

I also lowered the debug pointer coefficient. Boids moving at a normal
velocity are actually fast enough to draw a meaningful line. Maybe I'll
switch it into some kind of exponential space so small changes are
visible, and big changes don't draw a line all the way across the
screen.
2024-07-11 16:53:38 -05:00
336992573e Completed velocity pointer gizmo
Right-clicking toggles velocity sensing mode and the cursor gets a line
that indicates the average velocity of the targeted points.

There is a coefficient of 50.0 on the pointer magnitude. The boids move
so slowly that the line is very short without this magnification.

There is also something wrong with the math. The boids expand and slow
down, but the velocity vector does not reflect this. It *grows* slightly
and then stays at that size as the boids slowly approach a stop.

When writing the average velocity function, I realized that it is
**exactly** the same as the center of mass function. They're both just
averaging a bunch of points. Both functions are implemented as pass-
through calls to a general purpose Vec2 averaging function.

The `impl Iterator<...>...` *is* actually necessary because of the use
of `map()`s to filter out the boids parts from the spatial tree.
2024-07-11 14:46:36 -05:00
a0d2e2b467 Debug draw CoM is working!... CoM has error
The debug tool can draw a center-of-mass dot, but it doesn't look like
a sensible location. Time to check on the math, I guess.
2024-07-11 14:02:55 -05:00
c75374a566 Cursor gizmo mode changing inputs are working 2024-07-11 11:14:56 -05:00
3b03be7dbf Scaffolding for selection & scanning modes
The gizmo currently draws as an annulus with the intention that it is an
area selection tool. These new components will serve as mode selectors
so that different selection modes can be used.
2024-07-11 09:32:37 -05:00
2cbe15e72b New DebugUI plugin
This plugin is meant to have some add-ons to interact with the
simulation to provide insight.

This first change adds a cursor under the mouse with the intention that
it's circle can be used as a reticule for targeting boids. Hovering over
a cluster and getting their CoM or velocities, for example.
2024-07-11 09:16:42 -05:00