From 51723353fd3b721bc911f7f0cb0d0b9052ce7075 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Fri, 6 Mar 2026 22:49:37 +0100 Subject: [PATCH] update physics parameters --- include/config.hpp | 4 ++-- src/cpu_spring_system.cpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/config.hpp b/include/config.hpp index 1dc4d53..3a8bc29 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -66,11 +66,11 @@ constexpr float TIMESTEP = 1.0 / TARGET_UPS; // Update interval in seconds constexpr float SIM_SPEED = 4.0; // How large each update should be constexpr float MASS = 1.0; // Mass spring system constexpr float SPRING_K = 4.0; // Mass spring system -constexpr float DAMPENING_K = 1.0; // Mass spring system +constexpr float DAMPENING_K = 1.5; // Mass spring system constexpr float REST_LENGTH = 3.0; // Mass spring system constexpr float VERLET_DAMPENING = 0.1; // [0, 1] constexpr float BH_FORCE = 2.5; // Barnes-Hut [1.0, 3.0] -constexpr float THETA = 0.8; // Barnes-Hut [0.5, 1.0] +constexpr float THETA = 1.0; // Barnes-Hut [0.5, 1.0] constexpr float SOFTENING = 0.05; // Barnes-Hut [0.01, 1.0] // Graph Drawing diff --git a/src/cpu_spring_system.cpp b/src/cpu_spring_system.cpp index 64869e9..b86b09c 100644 --- a/src/cpu_spring_system.cpp +++ b/src/cpu_spring_system.cpp @@ -40,7 +40,9 @@ auto cpu_spring_system::add_spring(size_t a, size_t b) -> void Vector3 offset{static_cast(GetRandomValue(-100, 100)), static_cast(GetRandomValue(-100, 100)), static_cast(GetRandomValue(-100, 100))}; - offset = Vector3Normalize(offset) * REST_LENGTH; + + // By spawning the masses close together, we "explode" them naturally, so they cluster faster (also looks cool) + offset = Vector3Normalize(offset) * REST_LENGTH * 0.1; // If the offset moves the mass closer to the current center of mass, flip it if (!tree.empty()) {