Fixed player model submerging into the floor while swimming underwater

This commit is contained in:
Lwmte 2025-01-25 23:03:28 +01:00
parent faf17cd03a
commit d919e16790
3 changed files with 3 additions and 5 deletions

View file

@ -13,6 +13,7 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Fixed starfield remaining active in the next level, if next level does not have starfield specified.
* Fixed HK ammo not being visible in the inventory.
* Fixed flickering rat emitter.
* Fixed player model submerging into the floor while swimming underwater.
### New Features
* Added a particle based waterfall emitter object and associated sprite slots.

View file

@ -46,6 +46,7 @@ constexpr auto LARA_HEIGHT_TREAD = 700; // Height in water tread states.
constexpr auto LARA_HEIGHT_STRETCH = 870; // Height in jump up and ledge hang states.
constexpr auto LARA_HEIGHT_REACH = 820; // Height in reach state.
constexpr auto LARA_HEIGHT_SURFACE = 800; // Height when resurfacing water.
constexpr auto LARA_HEIGHT_UNDERWATER = 264; // Minimum height underwater.
constexpr auto LARA_HEADROOM = 160; // Reasonable space above head.
constexpr auto LARA_RADIUS = 100;
constexpr auto LARA_RADIUS_CRAWL = 200;

View file

@ -540,13 +540,9 @@ void LaraSwimCollision(ItemInfo* item, CollisionInfo* coll)
coll->Setup.ForwardAngle = item->Pose.Orientation.y;
}
int height = abs(LARA_HEIGHT * phd_sin(item->Pose.Orientation.x));
int height = std::max((int)abs(LARA_HEIGHT * phd_sin(item->Pose.Orientation.x)), LARA_HEIGHT_UNDERWATER);
auto offset = Vector3i(0, height / 2, 0);
auto level = g_GameFlow->GetLevel(CurrentLevel);
if (height < ((level->GetLaraType() == LaraType::Divesuit) << 6) + 200)
height = ((level->GetLaraType() == LaraType::Divesuit) << 6) + 200;
coll->Setup.UpperFloorBound = -CLICK(0.25f);
coll->Setup.Height = height;