Skip to content

Interpolation exploration#28

Open
ThierryBerger wants to merge 7 commits into
master-bevy_0.15from
interpolation_exploration
Open

Interpolation exploration#28
ThierryBerger wants to merge 7 commits into
master-bevy_0.15from
interpolation_exploration

Conversation

@ThierryBerger
Copy link
Copy Markdown
Owner

@ThierryBerger ThierryBerger commented Nov 25, 2024

Current interpolation within bevy_rapier is complex to understand in which schedules it takes place, and how it interact with those. Using bevy_transform_interpolate could help with simplifying bevy_rapier codebase and offer a better experience for users.

Screencast.from.11-25-2024.04.11.24.PM.webm

Comment on lines +17 to +21
.insert_resource(TimestepMode::Variable {
max_dt: 100f32,
time_scale: 1f32,
substeps: 10,
})
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

This ends up in a warning recommending using fixed timestamp, but that doesn´t make much sense because then we use Time<Fixed> ; also, TimestepMode::Variable allows us to modify time_scale.

.add_plugins((
DefaultPlugins,
TransformInterpolationPlugin::default(),
RapierPhysicsPlugin::<NoUserData>::pixels_per_meter(100.0).in_fixed_schedule(),
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

bevy_transform_interpolation wouldn't work if we used Update ; but it makes no sense to interpolate when using Update schedule.

Comment thread src/render/mod.rs
Comment on lines +164 to +177
DebugRenderObject::RigidBody(h, ..) => {
let Some(collider) = self.context.bodies.get(h) else {
return false;
};
let entity = Entity::from_bits(collider.user_data as u64);

let collider_debug =
if let Ok(collider_override) = self.override_visibility.get(entity) {
*collider_override
} else {
self.default_collider_debug
};
collider_debug == ColliderDebug::AlwaysRender
}
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

This is outside of this PR's scope, but helps with suppressing debug drawing for rigidbodies ; we could parameterize more the ColliderDebug but I'm leaving it as a future exercise on user feedback for now.

@ThierryBerger ThierryBerger force-pushed the interpolation_exploration branch from 8e616d9 to 66c0b2e Compare November 25, 2024 15:34
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

This example should be added to scraped examples

@ThierryBerger ThierryBerger force-pushed the master-bevy_0.15 branch 3 times, most recently from fd85257 to ab4fc3c Compare December 6, 2024 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant