MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / getSceneNodeByPosition

Method getSceneNodeByPosition

src/Core/Scene/Scene.cpp:700–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

698 }
699
700 SceneNode* Scene::getSceneNodeByPosition(const Transform::UnitVector& position) const
701 {
702 for (auto& gameObject : m_gameObjectArray)
703 {
704 const Transform::UnitVector sceneNodePosition
705 = gameObject->getSceneNode().getPosition();
706 const Transform::UnitVector pVec
707 = position.to<Transform::Units::SceneUnits>();
708 const Transform::UnitVector pTolerance
709 = Transform::UnitVector(6, 6, Transform::Units::ScenePixels)
710 .to<Transform::Units::SceneUnits>();
711
712 if (Utils::Math::isBetween(pVec.x, sceneNodePosition.x - pTolerance.x,
713 sceneNodePosition.x + pTolerance.x))
714 {
715 if (Utils::Math::isBetween(pVec.y, sceneNodePosition.y - pTolerance.x,
716 sceneNodePosition.y + pTolerance.y))
717 return &gameObject->getSceneNode();
718 }
719 }
720 return nullptr;
721 }
722
723 std::pair<Collision::PolygonalCollider*, int> Scene::getColliderPointByPosition(
724 const Transform::UnitVector& position)

Callers

nothing calls this directly

Calls 3

UnitVectorClass · 0.85
isBetweenFunction · 0.85
getPositionMethod · 0.45

Tested by

no test coverage detected