NcEngine
SpringSettings.h
Go to the documentation of this file.
1
5#pragma once
6
7namespace nc
8{
11{
13 struct Frequency
14 {
15 static constexpr auto Disabled = 0.0f;
16 static constexpr auto Soft = 2.0f;
17 static constexpr auto Stiff = 20.0f;
18 static constexpr auto Max = 30.0f;
19 };
20
22 struct Damping
23 {
24 static constexpr auto Undamped = 0.0f;
25 static constexpr auto Underdamped = 0.5f;
26 static constexpr auto Critical = 1.0f;
27 static constexpr auto Overdamped = 2.0f;
28 };
29
32};
33} // namespace nc
Spring damping value hints.
Definition: SpringSettings.h:23
static constexpr auto Underdamped
some energy loss, moderate oscillation (underdamping applies when 0 < d < 1)
Definition: SpringSettings.h:25
static constexpr auto Undamped
minimal energy loss, maximum oscillation (not completely lossless for stability)
Definition: SpringSettings.h:24
static constexpr auto Overdamped
energy loss occurs even outside of oscillation (overdamping applies when d > 1)
Definition: SpringSettings.h:27
static constexpr auto Critical
full energy loss, no oscillation
Definition: SpringSettings.h:26
Spring frequency value hints.
Definition: SpringSettings.h:14
static constexpr auto Max
frequency should not exceed half simulation frequency (assumes 60 fps here)
Definition: SpringSettings.h:18
static constexpr auto Disabled
disable the spring
Definition: SpringSettings.h:15
static constexpr auto Soft
typical soft spring
Definition: SpringSettings.h:16
static constexpr auto Stiff
typical stiff spring
Definition: SpringSettings.h:17
Settings for softening constraints with a spring-damper.
Definition: SpringSettings.h:11
float frequency
oscillation rate in hertz [0, targetFPS / 2]
Definition: SpringSettings.h:30
float damping
oscillation decay [0, 1] (typical max is 1, but larger values are allowed)
Definition: SpringSettings.h:31