bevy_xpbd
bevy_xpbd copied to clipboard
Strange behavior of objects from physics. Very high frequency oscillation.
trafficstars
Cargo.toml
[package]
name = "demo-01"
version = "0.1.0"
edition = "2021"
[dependencies]
bevy = { version = "0.15.0" }
bevy_dev_tools = "0.15.0"
bevy_window = "0.15.0"
bevy_diagnostic = "0.15.0"
avian3d = { git = "https://github.com/Jondolf/avian", branch = "main" }
# bevy = { version = "0.14.2" }
# bevy_dev_tools = "0.14.2"
# bevy_window = "0.14.2"
# bevy_diagnostic = "0.14.2"
# avian3d = "0.1"
noise = "0.9.0"
wgpu = "23.0.1"
tracing = "0.1.41"
[profile.dev]
opt-level = 1
[profile.dev.package."*"]
opt-level = 3
[profile.release]
debug = false
opt-level = 3
# [profile.release]
# lto = true
# opt-level = 3
# codegen-units = 1
# incremental = false
# [workspace]
# resolver = "2"
System:
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
uname -a
Linux toor-abi 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22) x86_64 GNU/Linux
rustc --version
rustc 1.83.0 (90b35a623 2024-11-26)
cargo --version
cargo 1.83.0 (5ffbef321 2024-10-29)
get_defaul_physic_debug_params
pub fn get_defaul_physic_debug_params() -> DebugRender {
if ALLOWED_DEBUG_PHYSICS {
DebugRender::default()
.with_collider_color(Color::srgb(1.0, 255.0, 1.0))
.with_axes(Vec3::new(2.0, 2.0, 2.0))
.with_aabb_color(Color::srgb(255.0, 0.0, 0.0))
} else {
DebugRender::none()
}
}
fn startup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>
) {
commands.spawn((
RigidBody::Dynamic,
// Collider::sphere(1.65),
Collider::sphere(2.0),
// CollisionMargin(COLLISION_MARGIN * 10.0),
Transform::from_xyz(-20.0, 20.0, 20.0).looking_at(Vec3::ZERO, Vec3::ZERO),
Mesh3d(meshes.add(Sphere::new(2.0))),
MeshMaterial3d(materials.add(Color::srgb_u8(255, 40, 40))),
// AngularVelocity(Vec3::new(2.5, 3.5, 1.5)),
Mass(10.0),
get_defaul_physic_debug_params(),
AnyObject,
));
// ...
}
little demo of the issue it self
https://www.youtube.com/watch?v=8Ep7YQqz2c8