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

Method IntersectsEntry

Source/Engine/Level/Actors/StaticModel.cpp:607–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605}
606
607bool StaticModel::IntersectsEntry(int32 entryIndex, const Ray& ray, Real& distance, Vector3& normal)
608{
609 auto model = Model.Get();
610 if (!model || !model->IsInitialized() || model->GetLoadedLODs() == 0)
611 return false;
612
613 // Find mesh in the highest loaded LOD that is using the given material slot index and ray hits it
614 auto& meshes = model->LODs[model->HighestResidentLODIndex()].Meshes;
615 for (int32 i = 0; i < meshes.Count(); i++)
616 {
617 const auto& mesh = meshes[i];
618 if (mesh.GetMaterialSlotIndex() == entryIndex && mesh.Intersects(ray, _transform, distance, normal))
619 return true;
620 }
621
622 distance = 0;
623 normal = Vector3::Up;
624 return false;
625}
626
627bool StaticModel::IntersectsEntry(const Ray& ray, Real& distance, Vector3& normal, int32& entryIndex)
628{

Callers 2

SetDragEffectsMethod · 0.45
SpawnMethod · 0.45

Calls 4

GetMethod · 0.45
IsInitializedMethod · 0.45
CountMethod · 0.45
IntersectsMethod · 0.45

Tested by

no test coverage detected