1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +00:00
OpenMW/apps/openmw/mwphysics/constants.hpp
wareya 49d2daee6a Movement solver tweaks
1) As much as I dislike it, upping the collision margin from 0.1 to 0.2
fixes bugs, particularly involving walking into upwards-slanted walls.

2) There were still some problems involving acute crevices/seams; they
were using the adjusted instead of unadjusted normal, and also they need
to bypass the don't-slide-upwards check to prevent (see #6379)

3) The move-away-from-what-we-just-hit code needs to run always, not
just on non-initial iterations. No idea why I did it this way before.

4) Force bullet to give actor boxes a tiny collision margin of 0.001
instead of the default 0.04. I can't tell whether this is actually
working or not, but it should reduce unexplained weirdness.

5) A piece of code that was meant to prevent bugs by short-circuiting
the movement solver if its direction changed more than 180 degrees
actually caused problems instead of preventing them, so I deleted it.
2021-11-05 14:56:55 -04:00

25 lines
1.2 KiB
C++

#ifndef OPENMW_MWPHYSICS_CONSTANTS_H
#define OPENMW_MWPHYSICS_CONSTANTS_H
namespace MWPhysics
{
static constexpr float sStepSizeDown = 62.0f;
static constexpr float sMinStep = 10.0f; // hack to skip over tiny unwalkable slopes
static constexpr float sMinStep2 = 20.0f; // hack to skip over shorter but longer/wider/further unwalkable slopes
// whether to do the above stairstepping logic hacks to work around bad morrowind assets - disabling causes problems but improves performance
static constexpr bool sDoExtraStairHacks = true;
static constexpr float sGroundOffset = 1.0f;
// Arbitrary number. To prevent infinite loops. They shouldn't happen but it's good to be prepared.
static constexpr int sMaxIterations = 8;
// Allows for more precise movement solving without getting stuck or snagging too easily.
static constexpr float sCollisionMargin = 0.2f;
// Allow for a small amount of penetration to prevent numerical precision issues from causing the "unstuck"ing code to run unnecessarily
// Currently set to 0 because having the "unstuck"ing code run whenever possible prevents some glitchy snagging issues
static constexpr float sAllowedPenetration = 0.0f;
}
#endif