|
RigsofRods
Soft-body Physics Simulation
|
Go to the documentation of this file.
44 ImGui::SetNextWindowPosCenter(ImGuiCond_FirstUseEver);
45 ImGuiWindowFlags win_flags = ImGuiWindowFlags_NoCollapse;
46 bool keep_open =
true;
47 ImGui::Begin(
_LC(
"FrictionSettings",
"Friction Settings"), &keep_open, win_flags);
49 ImGui::Text(
"%s",
_LC(
"FrictionSettings",
"Current active Ground: "));
54 ImGui::PushItemWidth(200.f);
56 ImGui::Combo(
_LC(
"FrictionSettings",
"selected Ground Type:"), &
m_selected_gm,
62 ImGui::TextDisabled(
"%s",
_LC(
"FrictionSettings",
"Solid ground settings"));
64 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"Solid ground level:"), &gm.
solid_ground_level, 0.f, 200.f)) { dirty =
true; }
65 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Solid ground level"),
_LC(
"FrictionSettings",
"With this you can define how deep the solid ground is. If it is 0 then the surface will be solid. If it is 0.1 then you'll have 10 cm of fluid on top of solid ground. If it is 100 then the solid ground will be way deep (100m), with fluid on top."));
67 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"Strength:"), &gm.
strength, 0.f, 2.f)) { dirty =
true; }
68 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Strength"),
_LC(
"FrictionSettings",
"This parameter raises or diminishes surface friction in a generic way. It is here so as to be able to do quick calibrations of friction. Start with having this to 1.0 and after tuning the rest of the surface variables, come back and play with this."));
70 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"Static friction coef:"), &gm.
ms, 0.1f, 2.f)) { dirty =
true; }
71 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Static friction coef"),
_LC(
"FrictionSettings",
"Static friction keeps you in the same place when you are stopped on a hill. In the real world this friction is always bigger than dynamic friction (sliding friction). Start with 0.5 and work from there. It is better to try to find some experimentally validated values for this and the rest of surface friction variables in the net, and then to fine tune via strength."));
73 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"Adhesion velocity:"), &gm.
va, 0.1f, 5.f)) { dirty =
true; }
74 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Adhesion velocity"),
_LC(
"FrictionSettings",
"Below this value static friction laws apply, above it dynamic friction laws apply. Value should be small, in the range of 0.1-0.4 . This velocity threshold is also used by fluid dynamics so you should always define it. NEVER set it to 0."));
76 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"Dynamic friction coef:"), &gm.
mc, 0.1f, 1.5f)) { dirty =
true; }
77 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Dynamic friction coef"),
_LC(
"FrictionSettings",
"Or sliding friction coef. It should be smaller than static friction coef. This parameter defines how much friction you'll have when sliding. Try to find some values for it from the net."));
79 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"Hydrodynamic friction coef:"), &gm.
t2, 0.f, 1.5f)) { dirty =
true; }
80 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Hydrodynamic friction coef"),
_LC(
"FrictionSettings",
"This friction defines the added friction that you'll feel from a surface that has a little film of fluid on it. It is kind of redundant with all the fluid physics below, but it is here so as for experimentally validated values from the net to be usable. If you decide that you'll simulate the film of fluid with the more complex fluid physics below, then just set this to 0."));
82 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"Stribeck velocity:"), &gm.
vs, 0.f, 1000.f)) { dirty =
true; }
83 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Stribeck velocity"),
_LC(
"FrictionSettings",
"You'll either find stribeck velocity in the net, or the inverse (1/stribeck velocity) of it described as 'stribeck coef'. It defines the shape of the dynamic friction curve. Lets leave it at that. Just find some nice values for it from the net."));
85 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"alpha:"), &gm.
alpha, 0.f, 200.f)) { dirty =
true; }
86 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Alpha"),
_LC(
"FrictionSettings",
"Its usual value is 2. But you can try others."));
88 ImGui::TextDisabled(
"%s",
_LC(
"FrictionSettings",
"Fluid Settings"));
90 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"Flow behavior index:"), &gm.
flow_behavior_index, -2.f, 2.f)) { dirty =
true; }
91 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Flow behavior index"),
_LC(
"FrictionSettings",
"If it is 1.0 then the fluid will behave like water. The lower you get from 1.0, the more like mud the fluid will behave, meaning that for small velocities the fluid will resist motion and for large velocities the fluid will not resist so much. The higher you get from 1.0 the more like sand the fluid will behave. The bigger the velocity, the bigger the resistance of the fluid (try to hit sand hard it'll feel like stone)."));
93 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"Flow consistency:"), &gm.
flow_consistency_index, 10.f, 100000.f)) { dirty =
true; }
94 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Flow consistency"),
_LC(
"FrictionSettings",
"Think of it as default fluid resistance. Behavior index above changes it at real time. Useful values in practice are quite large."));
96 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"Fluid density:"), &gm.
fluid_density, 10.f, 100000.f)) { dirty =
true; }
97 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Fluid density"),
_LC(
"FrictionSettings",
"In mud (or sand) the resistance of the fluid described by the parameters above will stop you and so keep you from sinking. But for substances like water it isn't the drag that stops you from sinking. Its buoyancy. This parameter is here so as to keep you from sinking when you wish to simulate fluids with low drag (resistance). For fluids like mud or sand you can put it at 0, but it is best to keep it at some minimum value. For fluids with behavior index >=1 it will behave like you are in water. For fluids with behavior index <1 it'll behave like you are in mud."));
99 if (ImGui::SliderFloat(
_LC(
"FrictionSettings",
"Drag anisotropy:"), &gm.
drag_anisotropy, 0.f, 1.f)) { dirty =
true; }
100 this->
DrawTooltip(
_LC(
"FrictionSettings",
"Drag anisotropy"),
_LC(
"FrictionSettings",
"This parameter is for making it easier(cheating) to get out from mud. To get stuck in real mud isn't fun at all, so this makes the mud push up. Ranges in this parameter are from 0 to 1 . If you set it at 1 then you'll get real mud. For values from 0 to 1, the behavior goes from real mud to easy mud depending on this parameter and the value of Adhesion velocity. For velocity 0 real mud it is. For velocity >= adhesion velocity easy mud it is."));
117 ImGui::PopItemWidth();
119 m_is_hovered = ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows);
133 auto items =
static_cast<std::vector<FrictionSettings::Entry>*
>(data);
135 *out_text = (*items)[idx].live_data->name;
144 for (; itor != endi; ++itor)
153 ImGui::TextDisabled(
"[?]");
154 if (ImGui::IsItemHovered())
156 ImGui::SetNextWindowSizeConstraints(ImVec2(250.f, 50.f), ImVec2(1000.f, 1000.f));
157 ImGui::BeginTooltip();
158 ImGui::Text(
"%s", title);
160 ImGui::TextWrapped(
"%s", text);
Game state manager and message-queue provider.
float solid_ground_level
how deep the solid ground is
float strength
ground strength
float va
adhesion velocity
GUIManager * GetGuiManager()
static bool GmComboItemGetter(void *data, int idx, const char **out_text)
const ground_model_t * m_nearest_gm
std::vector< Entry > m_gm_entries
float mc
sliding friction coefficient
float vs
stribeck velocity (m/s)
Core data structures for simulation; Everything affected by by either physics, network or user intera...
void PushMessage(Message m)
Doesn't guarantee order! Use ChainMessage() if order matters.
Collisions * GetCollisions()
Central state/object manager and communications hub.
GameContext * GetGameContext()
void SetVisible(bool visible)
float t2
hydrodynamic friction (s/m)
void DrawTooltip(const char *title, const char *text)
float ms
static friction coefficient
float flow_behavior_index
if flow_behavior_index<1 then liquid is Pseudoplastic (ketchup, whipped cream, paint) if =1 then liqu...
Unified game event system - all requests and state changes are reported using a message.
float fluid_density
Density of liquid.
Surface friction properties.
float drag_anisotropy
Upwards/Downwards drag anisotropy.
std::map< Ogre::String, ground_model_t > * getGroundModels()
@ MSG_EDI_MODIFY_GROUNDMODEL_REQUESTED
Payload = RoR::ground_model_t* (weak)
float flow_consistency_index
general drag coefficient
or anywhere else will not be considered a but parsed as regular data ! Each line is treated as values separated by separators Possible i e animators Multiline description Single does not affect it Directive usualy set global attributes or change behavior of the parsing Directive may appear in any block section Modularity The elements can be grouped into modules Each module must belong to one or more configurations Directives sectionconfig specify truck configurations the user can choose from Exactly one must be selected If the first defined is used lettercase matches original docs(parsing is insensitive). NAME TYPE NOTES advdrag BLOCK add_animation DIRECTIVE Special syntax airbrakes BLOCK animators BLOCK Special syntax IF(values[0]=="") bad trailing chars are silently ignored no space at the end Items delimited On each side of there is max item Empty invalid string parses as node num items
void RequestGuiCaptureKeyboard(bool val)
Pass true during frame to prevent input passing to application.
const TerrainPtr & GetTerrain()