From 7cb89d906763cacd5ef5547c80b1fe89d1603e99 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Wed, 14 Jan 2026 21:22:51 +0900 Subject: [PATCH] =?UTF-8?q?[add]=20MapProp=20=EB=B2=BD=EC=B6=A9=EB=8F=8C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Client/Private/Level_GamePlay.cpp | 8 +- Jusin154_Team3D/Client/Private/Loader.cpp | 4 +- .../Private/MapElement_Interactable.cpp | 166 +++++++----------- .../Client/Public/MapElement_Interactable.h | 1 + 4 files changed, 67 insertions(+), 112 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 88a37285b..ec76dca51 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -126,7 +126,7 @@ HRESULT CLevel_GamePlay::Initialize(void* pArg) _bool bLoadNPC = { true }; #ifdef _DEBUG #ifdef 기무리 - bLoadNPC = false; + bLoadNPC = true; #endif #endif // _DEBUG if (true == bLoadNPC) { @@ -365,7 +365,7 @@ HRESULT CLevel_GamePlay::Ready_Background() #ifdef 기무리 isReady_Background = true; isReady_Hogsmeade = true; - isReady_Hogwart = false; + isReady_Hogwart = true; #endif // #ifdef 나 isReady_Background = false; @@ -1140,8 +1140,8 @@ HRESULT CLevel_GamePlay::Ready_Layer_Npc() isLoad_NPC = false; #endif // #ifdef 기무리 - isLoad_NPC = false; - isLoad_RandomNPC = false; + isLoad_NPC = true; + isLoad_RandomNPC = true; #endif // #ifdef 나 isLoad_RandomNPC = true; diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 84c1503c1..2b8768e0c 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -563,9 +563,9 @@ HRESULT CLoader::Loading_For_GamePlay() #endif // #ifdef 기무리 isLoad_Background = true; - isLoad_Hogwart = false; + isLoad_Hogwart = true; isLoad_UI_SEQUANTIAL = false; - isLoad_NPC = false; + isLoad_NPC = true; isLoad_Monster = true; #endif // #ifdef 나 diff --git a/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp b/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp index 96e04adb8..87d4830e3 100644 --- a/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp +++ b/Jusin154_Team3D/Client/Private/MapElement_Interactable.cpp @@ -99,7 +99,7 @@ void CMapElement_Interactable::Late_Update(_float fTimeDelta) { if (m_bVisible) { - if (m_isGraped == true) + if (m_bThrow == true) { _float fRadius = m_pModelComs[0]->Get_Radius(); @@ -344,123 +344,77 @@ ON_COLLISION_INFO CMapElement_Interactable::CollisionCheck(_fvector StartPos, _f _float fDistance = XMVectorGetX(XMVector3Length(vEndPos - vStartPos)); - PSX::PxSweepBuffer pxBuffer = {}; + PSX::PxSweepBufferN<12> pxBuffer = {}; - _bool bHit = m_pGameInstance->SphereCast(fRadius, vStartPos, vDir, fDistance, PSX::PxHitFlag::ePOSITION | PSX::PxHitFlag::eNORMAL, PSX::PxQueryFlag::eDYNAMIC, pxBuffer); - - const PSX::PxSweepHit& hit = pxBuffer.block; - PSX::PxRigidActor* pActor = hit.actor; - PSX::PxShape* pShape = hit.shape; + _bool bHit = m_pGameInstance->SphereCast(fRadius, vStartPos, vDir, fDistance, PSX::PxHitFlag::eDEFAULT, PSX::PxQueryFlag::eDYNAMIC | PSX::PxQueryFlag::eSTATIC | PSX::PxQueryFlag::eNO_BLOCK, pxBuffer); ON_COLLISION_INFO tagCollInfo = {}; - + XMStoreFloat4(&tagCollInfo.vHitDir, vDir); tagCollInfo.vWorldPos.w = 1.f; - if (bHit) { - - memcpy_s(&tagCollInfo.vWorldPos, sizeof(tagCollInfo.vWorldPos), &hit.position, sizeof(hit.position)); - - memcpy_s(&tagCollInfo.vWorldNomal, sizeof(tagCollInfo.vWorldNomal), &hit.normal, sizeof(hit.normal)); - XMStoreFloat4(&tagCollInfo.vHitDir, vDir); - tagCollInfo.fLength = fDistance; - - - if (nullptr != pActor && nullptr != pActor->userData) - { - PHYSX_USERDATA* pUserData = static_cast(pActor->userData); - tagCollInfo.pObject = pUserData->pOwner; - - switch (pUserData->eKind) - { - case PHYSX_KIND::CCTActor: - { - switch (PXOBJECT(pUserData->iSubKind)) - { - case PXOBJECT::MONSTER: + HRESULT hr = CheckHit(&pxBuffer.block, tagCollInfo); + if (FAILED(hr)) { + PSX::PxSweepHit* hits = pxBuffer.touches; + _uint iHitCount = pxBuffer.getNbTouches(); + for (_uint i = 0; i < iHitCount; ++i) { + PSX::PxSweepHit* pHit = &pxBuffer.touches[i]; + hr = CheckHit(pHit, tagCollInfo); + if (SUCCEEDED(hr)) { break; - case PXOBJECT::GOBLIN_WARRIOR: - { - pUserData->pOwner->OnCollision(this, &tagCollInfo); - m_bHit = true; } - break; - case PXOBJECT::GOBLIN_MAGICIAN: - { - pUserData->pOwner->OnCollision(this, &tagCollInfo); - m_bHit = true; - } - break; - case PXOBJECT::GOBLIN_ASSASSIN: - { - pUserData->pOwner->OnCollision(this, &tagCollInfo); - m_bHit = true; - } - break; - case PXOBJECT::TROLL: - { - pUserData->pOwner->OnCollision(this, &tagCollInfo); - m_bHit = true; - } - break; - case PXOBJECT::RANROK_BODY: - case PXOBJECT::RANROK: - { - pUserData->pOwner->OnCollision(this, &tagCollInfo); - m_bHit = true; - } - break; - } - } } } } - - if (bHit == false) - { - memcpy_s(&tagCollInfo.vWorldPos, sizeof(tagCollInfo.vWorldPos), &hit.position, sizeof(hit.position)); - memcpy_s(&tagCollInfo.vWorldNomal, sizeof(tagCollInfo.vWorldNomal), &hit.normal, sizeof(hit.normal)); - XMStoreFloat4(&tagCollInfo.vHitDir, vDir); - tagCollInfo.fLength = fDistance; - tagCollInfo.pObject = this; - - bHit = m_pGameInstance->SphereCast(fRadius, vStartPos, vDir, fDistance, PSX::PxHitFlag::ePOSITION | PSX::PxHitFlag::eNORMAL, PSX::PxQueryFlag::eSTATIC, pxBuffer); - - const PSX::PxSweepHit& hit = pxBuffer.block; - PSX::PxRigidActor* pActor = hit.actor; - PSX::PxShape* pShape = hit.shape; - - tagCollInfo.vWorldPos.w = 1.f; - - if (bHit) - { - memcpy_s(&tagCollInfo.vWorldPos, sizeof(tagCollInfo.vWorldPos), &hit.position, sizeof(hit.position)); - memcpy_s(&tagCollInfo.vWorldNomal, sizeof(tagCollInfo.vWorldNomal), &hit.normal, sizeof(hit.normal)); - XMStoreFloat4(&tagCollInfo.vHitDir, vDir); - tagCollInfo.fLength = fDistance; - - if (nullptr != pActor && nullptr != pActor->userData) - { - PHYSX_USERDATA* pUserData = static_cast(pActor->userData); - tagCollInfo.pObject = pUserData->pOwner; - - switch (PXOBJECT(pUserData->iSubKind)) - { - case PXOBJECT::TERRAIN: - { - /* TODO, 터레인 안됨 */ - m_bHit = true; - break; - } - } - - } - } - - - } - return tagCollInfo; } +HRESULT CMapElement_Interactable::CheckHit(PSX::PxSweepHit* pHit, ON_COLLISION_INFO& Info) +{ + HRESULT hr = E_FAIL; + PSX::PxActor* pActor = pHit->actor; + PSX::PxShape* pShape = pHit->shape; + PHYSX_USERDATA* pUserData = { nullptr }; + CGameObject* pTarget = { nullptr }; + if (nullptr != pActor && nullptr != pActor->userData || nullptr != pShape && nullptr != pShape->userData) { + pUserData = static_cast(pActor->userData); + if (nullptr == pUserData) { + pUserData = static_cast(pShape->userData); + } + switch (pUserData->eKind) + { + case PHYSX_KIND::BODY_STATIC: + case PHYSX_KIND::CCTActor: + { + switch (PXOBJECT(pUserData->iSubKind)) + { + case PXOBJECT::TERRAIN: + case PXOBJECT::GOBLIN_WARRIOR: + case PXOBJECT::GOBLIN_MAGICIAN: + case PXOBJECT::GOBLIN_ASSASSIN: + case PXOBJECT::TROLL: + case PXOBJECT::RANROK_BODY: + case PXOBJECT::RANROK: + { + hr = S_OK; + m_bHit = true; + } break; + default: + break; + } + } break; + default: + break; + } + } + if (SUCCEEDED(hr)) { + memcpy_s(&Info.vWorldPos, sizeof(Info.vWorldPos), &pHit->position, sizeof(pHit->position)); + memcpy_s(&Info.vWorldNomal, sizeof(Info.vWorldNomal), &pHit->normal, sizeof(pHit->normal)); + Info.fLength = pHit->distance; + Info.pObject = pUserData->pOwner; + Info.pObject->OnCollision(this, &Info); + } + return hr; +} + CMapElement_Interactable* CMapElement_Interactable::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { CMapElement_Interactable* pInstance = new CMapElement_Interactable(pDevice, pContext); diff --git a/Jusin154_Team3D/Client/Public/MapElement_Interactable.h b/Jusin154_Team3D/Client/Public/MapElement_Interactable.h index 9a8b9982f..67c48aa7f 100644 --- a/Jusin154_Team3D/Client/Public/MapElement_Interactable.h +++ b/Jusin154_Team3D/Client/Public/MapElement_Interactable.h @@ -62,6 +62,7 @@ class CMapElement_Interactable final : public CMapElement virtual HRESULT Initialize(void* pArg) override; virtual HRESULT Ready_Components(void* pArg) override; virtual HRESULT Bind_ShaderResources() override; + HRESULT CheckHit(PSX::PxSweepHit* pHit, ON_COLLISION_INFO& Info); public: static CMapElement_Interactable* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);