Skip to content

Migration of bevy from 0.16 to 0.17#590

Merged
gbin merged 20 commits into
masterfrom
yang/chore/bevy_0.17
Jan 4, 2026
Merged

Migration of bevy from 0.16 to 0.17#590
gbin merged 20 commits into
masterfrom
yang/chore/bevy_0.17

Conversation

@makeecat

@makeecat makeecat commented Jan 1, 2026

Copy link
Copy Markdown
Collaborator
  1. Dependency Upgrades (Cargo.toml)
  • bevy: 0.16.0 → 0.17.3
    • Added new features: bevy_ui_render, zstd_rust, trace, reflect_auto_register
  • avian3d: 0.3.0 → 0.4.1
    • Added feature: xpbd_joints
  • Removed: iyes_perf_ui
  • Added: bevy_anti_alias (0.17.3), bevy_utils (0.17.3)

  1. New Motor Model (src/motor_model.rs)

New module centralizing physics constants:

  • MOTOR_MAX_ACCEL_G = 10.0 (max acceleration in multiples of g)
  • Shared geometry constants (CART_, ROD_, densities)
  • total_mass_kg() - computes cart + rod mass from colliders
  • force_from_power(power, mass) - converts motor power to force

Before: Force was motor_actuation.power * 2.0
After: Force is power * MOTOR_MAX_ACCEL * mass (physics-based)


  1. API Migration (world/mod.rs, sim.rs)
Bevy 0.16 / Avian 0.3 Bevy 0.17 / Avian 0.4
EventReader / EventWriter MessageReader / MessageWriter
ExternalForce::apply_force() ConstantForce (persistent across physics steps)
BorderColor(color) BorderColor::all(color)
Fxaa from bevy::core_pipeline bevy_anti_alias::fxaa::Fxaa
with_free_axis() with_slider_axis()
with_aligned_axis() with_hinge_axis()
with_local_anchor_1/2() with_local_anchor1/2()
with_compliance() with_*_compliance() (point/align/limit)
with_*_velocity_damping() JointDamping component
ChildOf.parent() Direct entity via drag.target()

  1. Physics Improvements

Drag handling refactored:

  • Replaced parent hierarchy traversal (get_rigid_body_entity) with direct drag.target()
  • Added DragState resource to track override_motor flag
  • Cart dragging now properly overrides motor control

New AppliedForce component: Tracks the force being applied for visualization (separate from physics forces)

New lock_cart_rotation system: Clamps cart rotation to initial orientation in FixedPostUpdate, preventing unwanted rotation even with joint constraints

Reset logic improved:

  • Now resets Position, Rotation, PreSolveDeltaPosition, PreSolveDeltaRotation
  • Uses ParamSet to avoid borrow conflicts
  • Resets accumulated accelerations via Forces query

  1. Type Registry for Scenes

Added explicit type registrations for scene serialization:
app.register_type::();
app.register_type::();
// ... etc
Plus assert_reflected_types startup system for validation.


  1. UI Updates
  • Removed iyes_perf_ui integration
  • Added IsDefaultUiCamera marker to camera
  • Minor formatting/style changes in UI setup

Thank @joshuaPurushothaman for the initial migration attempt and suggestions!

@makeecat makeecat added the dependencies Pull requests that update a dependency file label Jan 2, 2026
@makeecat makeecat requested a review from gbin January 2, 2026 12:22
@makeecat makeecat self-assigned this Jan 2, 2026
@makeecat makeecat requested a review from AS1100K January 2, 2026 13:45
@gbin

gbin commented Jan 2, 2026

Copy link
Copy Markdown
Collaborator

The physics seems to work out pretty well, I needed to tighten D for the rail pos it was becoming unstable (I should try it again on the real balance bot but this is a demo after all) :

image

@gbin

gbin commented Jan 2, 2026

Copy link
Copy Markdown
Collaborator

On the other hand it looks like I cannot manipulate the rod from the mouse click anymore on linux.

@gbin gbin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see the question about the UI manipulation

@gbin

gbin commented Jan 4, 2026

Copy link
Copy Markdown
Collaborator

works perfectly now

@gbin

gbin commented Jan 4, 2026

Copy link
Copy Markdown
Collaborator

Thanks!

@gbin gbin merged commit 7ac80ae into master Jan 4, 2026
7 checks passed
@gbin gbin deleted the yang/chore/bevy_0.17 branch January 4, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants