Fix compilation warnings on large worlds

This commit is contained in:
Wojtek Figat
2024-09-19 17:04:31 +02:00
parent 93d9b9877c
commit ba701eb4d3
3 changed files with 11 additions and 13 deletions

View File

@@ -396,8 +396,8 @@ void BehaviorTreeMoveToNode::GetAgentSize(Actor* agent, float& outRadius, float&
// Estimate actor bounds to extract capsule information
const BoundingBox box = agent->GetBox();
const BoundingSphere sphere = agent->GetSphere();
outRadius = sphere.Radius;
outHeight = box.GetSize().Y;
outRadius = (float)sphere.Radius;
outHeight = (float)box.GetSize().Y;
}
int32 BehaviorTreeMoveToNode::GetStateSize() const
@@ -522,7 +522,7 @@ String BehaviorTreeMoveToNode::GetDebugInfo(const BehaviorUpdateContext& context
goal = state->GoalLocation.ToString();
const Vector3 agentLocation = state->Agent->GetPosition();
const Vector3 agentLocationOnPath = agentLocation + state->AgentOffset;
float distanceLeft = state->Path.Count() > state->TargetPathIndex ? Vector3::Distance(state->Path[state->TargetPathIndex], agentLocationOnPath) : 0;
Real distanceLeft = state->Path.Count() > state->TargetPathIndex ? Vector3::Distance(state->Path[state->TargetPathIndex], agentLocationOnPath) : 0;
for (int32 i = state->TargetPathIndex; i < state->Path.Count(); i++)
distanceLeft += Vector3::Distance(state->Path[i - 1], state->Path[i]);
return String::Format(TEXT("Agent: '{}'\nGoal: '{}'\nDistance: {}"), agent, goal, (int32)distanceLeft);
@@ -559,7 +559,7 @@ void BehaviorTreeMoveToNode::State::OnUpdate()
const float acceptableHeightPercentage = 1.05f;
const float testHeight = agentHeight * acceptableHeightPercentage;
const Vector3 toGoal = agentLocationOnPath - pathSegmentEnd;
const float toGoalHeightDiff = (toGoal * UpVector).SumValues();
const Real toGoalHeightDiff = (toGoal * UpVector).SumValues();
if (toGoal.Length() <= testRadius && toGoalHeightDiff <= testHeight)
{
TargetPathIndex++;

View File

@@ -542,10 +542,8 @@ void Quaternion::RotationYawPitchRoll(float yaw, float pitch, float roll, Quater
Quaternion Quaternion::GetRotationFromNormal(const Vector3& normal, const Transform& reference)
{
Float3 up = reference.GetUp();
const float dot = Vector3::Dot(normal, up);
const Real dot = Vector3::Dot(normal, up);
if (Math::NearEqual(Math::Abs(dot), 1))
{
up = reference.GetRight();
}
return Quaternion::LookRotation(normal, up);
}

View File

@@ -494,28 +494,28 @@ void PhysicsScene::CollectResults()
bool PhysicsScene::LineCast(const Vector3& start, const Vector3& end, uint32 layerMask, bool hitTriggers)
{
Vector3 directionToEnd = end - start;
const float distanceToEnd = directionToEnd.Length();
const Real distanceToEnd = directionToEnd.Length();
if (distanceToEnd >= ZeroTolerance)
directionToEnd /= distanceToEnd;
return PhysicsBackend::RayCast(_scene, start, directionToEnd, distanceToEnd, layerMask, hitTriggers);
return PhysicsBackend::RayCast(_scene, start, directionToEnd, (float)distanceToEnd, layerMask, hitTriggers);
}
bool PhysicsScene::LineCast(const Vector3& start, const Vector3& end, RayCastHit& hitInfo, uint32 layerMask, bool hitTriggers)
{
Vector3 directionToEnd = end - start;
const float distanceToEnd = directionToEnd.Length();
const Real distanceToEnd = directionToEnd.Length();
if (distanceToEnd >= ZeroTolerance)
directionToEnd /= distanceToEnd;
return PhysicsBackend::RayCast(_scene, start, directionToEnd, hitInfo, distanceToEnd, layerMask, hitTriggers);
return PhysicsBackend::RayCast(_scene, start, directionToEnd, hitInfo, (float)distanceToEnd, layerMask, hitTriggers);
}
bool PhysicsScene::LineCastAll(const Vector3& start, const Vector3& end, Array<RayCastHit>& results, uint32 layerMask, bool hitTriggers)
{
Vector3 directionToEnd = end - start;
const float distanceToEnd = directionToEnd.Length();
const Real distanceToEnd = directionToEnd.Length();
if (distanceToEnd >= ZeroTolerance)
directionToEnd /= distanceToEnd;
return PhysicsBackend::RayCastAll(_scene, start, directionToEnd, results, distanceToEnd, layerMask, hitTriggers);
return PhysicsBackend::RayCastAll(_scene, start, directionToEnd, results, (float)distanceToEnd, layerMask, hitTriggers);
}
bool PhysicsScene::RayCast(const Vector3& origin, const Vector3& direction, const float maxDistance, uint32 layerMask, bool hitTriggers)