update physics engine parameters

This commit is contained in:
2026-02-19 22:05:46 +01:00
parent b873a1e9d7
commit 53a38e9cf3
2 changed files with 7 additions and 5 deletions

View File

@ -26,14 +26,15 @@ constexpr float PAN_MULTIPLIER = 10.0;
constexpr float ROT_SPEED = 1.0; constexpr float ROT_SPEED = 1.0;
// Physics Engine // Physics Engine
constexpr int UPDATES_PER_FRAME = 1;
constexpr float MASS = 1.0; constexpr float MASS = 1.0;
constexpr float SPRING_CONSTANT = 1.5; constexpr float SPRING_CONSTANT = 5.0;
constexpr float DAMPENING_CONSTANT = 0.8; constexpr float DAMPENING_CONSTANT = 1.0;
constexpr float REST_LENGTH = 1.0; constexpr float REST_LENGTH = 2.0;
constexpr float REPULSION_FORCE = 0.1; constexpr float REPULSION_FORCE = 0.1;
constexpr float REPULSION_RANGE = 3.0 * REST_LENGTH; constexpr float REPULSION_RANGE = 5.0 * REST_LENGTH;
constexpr int REPULSION_GRID_REFRESH = 5; // Frames between grid rebuilds constexpr int REPULSION_GRID_REFRESH = 5; // Frames between grid rebuilds
constexpr float VERLET_DAMPENING = 0.01; // [0, 1] constexpr float VERLET_DAMPENING = 0.05; // [0, 1]
// Graph Drawing // Graph Drawing
constexpr float VERTEX_SIZE = 0.1; constexpr float VERTEX_SIZE = 0.1;

View File

@ -183,6 +183,7 @@ auto MassSpringSystem::CalculateRepulsionForces() -> void {
Vector3 force = {0, 0, 0}; Vector3 force = {0, 0, 0};
// Search all 3*3*3 neighbor cells for particles
for (int dx = -1; dx <= 1; ++dx) { for (int dx = -1; dx <= 1; ++dx) {
for (int dy = -1; dy <= 1; ++dy) { for (int dy = -1; dy <= 1; ++dy) {
for (int dz = -1; dz <= 1; ++dz) { for (int dz = -1; dz <= 1; ++dz) {