Skip to content

Commit

Permalink
Fixed minor player collider warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
afritz1 committed Nov 16, 2024
1 parent ba9093c commit 64cefd6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions OpenTESArena/src/Entities/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ namespace
}

// Create same capsule for physical and virtual collider.
constexpr double capsuleRadius = PlayerConstants::COLLIDER_RADIUS;
constexpr double cylinderHalfHeight = (PlayerConstants::HEIGHT / 2.0) - capsuleRadius;
static_assert(cylinderHalfHeight >= 0.0);
static_assert(MathUtils::almostEqual((capsuleRadius * 2.0) + (cylinderHalfHeight * 2.0), PlayerConstants::HEIGHT));
constexpr float playerHeight = static_cast<float>(PlayerConstants::HEIGHT);
constexpr float capsuleRadius = static_cast<float>(PlayerConstants::COLLIDER_RADIUS);
constexpr float cylinderHalfHeight = static_cast<float>((playerHeight / 2.0) - capsuleRadius);
static_assert(cylinderHalfHeight >= 0.0f);
static_assert(MathUtils::almostEqual((capsuleRadius * 2.0f) + (cylinderHalfHeight * 2.0f), playerHeight));

JPH::CapsuleShapeSettings capsuleShapeSettings(cylinderHalfHeight, capsuleRadius);
capsuleShapeSettings.SetEmbedded(); // Marked embedded to prevent it from being freed when its ref count reaches 0.
Expand Down

0 comments on commit 64cefd6

Please sign in to comment.