MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / IntersectsItself

Method IntersectsItself

Source/Engine/Terrain/Terrain.cpp:684–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

682#endif
683
684bool Terrain::IntersectsItself(const Ray& ray, Real& distance, Vector3& normal)
685{
686 float minDistance = MAX_float;
687 Vector3 minDistanceNormal = Vector3::Up;
688 float tmpDistance;
689 Vector3 tmpNormal;
690 bool result = false;
691
692 for (int32 pathIndex = 0; pathIndex < _patches.Count(); pathIndex++)
693 {
694 const auto patch = _patches[pathIndex];
695 if (patch->HasCollision() &&
696 patch->_bounds.Intersects(ray) &&
697 patch->RayCast(ray.Position, ray.Direction, tmpDistance, tmpNormal) &&
698 tmpDistance < minDistance)
699 {
700 minDistance = tmpDistance;
701 minDistanceNormal = tmpNormal;
702 result = true;
703 }
704 }
705
706 distance = minDistance;
707 normal = minDistanceNormal;
708 return result;
709}
710
711void Terrain::Serialize(SerializeStream& stream, const void* otherObj)
712{

Callers

nothing calls this directly

Calls 3

CountMethod · 0.45
IntersectsMethod · 0.45
RayCastMethod · 0.45

Tested by

no test coverage detected