[add] MapProp 벽충돌 추가

This commit is contained in:
kimnuri
2026-01-14 21:22:51 +09:00
parent 82c75a673f
commit 7cb89d9067
4 changed files with 67 additions and 112 deletions
@@ -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;
+2 -2
View File
@@ -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 나
@@ -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<PHYSX_USERDATA*>(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<PHYSX_USERDATA*>(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<PHYSX_USERDATA*>(pActor->userData);
if (nullptr == pUserData) {
pUserData = static_cast<PHYSX_USERDATA*>(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);
@@ -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);