From ecb999d7c44a4bcd5a90bc3e0c6bdff53aea18cc Mon Sep 17 00:00:00 2001 From: Willow Sparks Date: Tue, 27 Jan 2026 13:39:21 +0000 Subject: [PATCH] Set physics materials in main.rs Update main application to use the new physics material system: - Import PhysicsMaterial from rust4d_physics - Set tesseract body to WOOD material (moderate friction, low bounce) - Configure floor with CONCRETE material (high friction, low bounce) Co-Authored-By: Claude Opus 4.5 --- src/main.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 541f135..b8ce21b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,7 @@ use rust4d_render::{ RenderableGeometry, CheckerboardGeometry, position_gradient_color, }; use rust4d_input::CameraController; -use rust4d_physics::{PlayerPhysics, Plane4D as PhysicsPlane, sphere_vs_aabb, Collider}; +use rust4d_physics::{PlayerPhysics, Plane4D as PhysicsPlane, sphere_vs_aabb, Collider, PhysicsMaterial}; use rust4d_math::Vec4; /// Main application state @@ -61,7 +61,9 @@ const FLOOR_Y: f32 = -2.0; impl App { fn new() -> Self { // Create the world with physics enabled - let physics_config = PhysicsConfig::new(GRAVITY, FLOOR_Y, 0.0); + // Concrete floor: high friction (0.7), low bounce (0.1) + let physics_config = PhysicsConfig::new(GRAVITY, FLOOR_Y, 0.0) + .with_floor_material(PhysicsMaterial::CONCRETE); let mut world = World::with_capacity(2).with_physics(physics_config); // Create tesseract physics body first @@ -70,7 +72,8 @@ impl App { let tesseract_start = Vec4::new(0.0, 0.0, 0.0, 0.0); let tesseract_body = RigidBody4D::new_aabb(tesseract_start, Vec4::new(1.0, 1.0, 1.0, 1.0)) .with_gravity(true) - .with_mass(10.0); // Heavy enough to feel solid + .with_mass(10.0) // Heavy enough to feel solid + .with_material(PhysicsMaterial::WOOD); // Wood-like: moderate friction, low bounce let tesseract_body = world.physics_mut().unwrap().add_body(tesseract_body); // Add tesseract entity linked to physics body -- knotmirror 0.0.1