From e22dfbeae8f2c1ac5bf32164d588b942d1ae1edb Mon Sep 17 00:00:00 2001 From: kimnuri Date: Sat, 15 Nov 2025 16:56:17 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[add]=20=ED=94=8C=EB=9E=AB=ED=8F=BC=20?= =?UTF-8?q?=EC=8A=AC=EB=9D=BC=EC=9D=B4=EB=93=9C=20=EC=BD=9C=EB=B0=B1=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jusin154_Team3D/Engine/Public/Transform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jusin154_Team3D/Engine/Public/Transform.h b/Jusin154_Team3D/Engine/Public/Transform.h index aac8532ca..597912153 100644 --- a/Jusin154_Team3D/Engine/Public/Transform.h +++ b/Jusin154_Team3D/Engine/Public/Transform.h @@ -67,7 +67,7 @@ class ENGINE_DLL CTransform final : _float m_fSpeedPerSec = {}; _float m_fRotationPerSec = {}; _float4x4 m_WorldMatrix = {}; - _float m_fRadius = {}; + _float m_fRadius = { 20.f }; _float3 m_vMomentum = {}; // 현재 프레임에 계산된 이동량 _float3 m_vBackMomentum = {}; // 다음 프레임에 계산될 이동량 From 84ad0bbad7a27d020b0c987ae51731e28e41323c Mon Sep 17 00:00:00 2001 From: kimnuri Date: Sat, 15 Nov 2025 16:56:32 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[add]=20=EC=8A=AC=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=93=9C=EC=BD=9C=EB=B0=B1=EC=B6=94=EA=B0=80#2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Private/CallBack_Playable_Behavior.cpp | 3 ++- .../Editor/Private/Dummy_PhysXPlatform.cpp | 17 ++++++++++++++++- .../Editor/Public/Dummy_PhysXPlatform.h | 2 +- .../Engine/Private/RigidBody_Dynamic.cpp | 11 ++++++----- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp b/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp index b900b6837..ef3c7179b 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp @@ -21,7 +21,8 @@ PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(con | PSX::PxControllerBehaviorFlag::eCCT_SLIDE; break; case PHYSX_KIND::BODY_DYNAMIC: - return PSX::PxControllerBehaviorFlag::eCCT_SLIDE; + return PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT + | PSX::PxControllerBehaviorFlag::eCCT_SLIDE; break; case PHYSX_KIND::CCTActor: // Action diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlatform.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlatform.cpp index 983797af7..abe07be1c 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlatform.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlatform.cpp @@ -39,6 +39,18 @@ void CDummy_PhysXPlatform::Priority_Update(_float fTimeDelta) void CDummy_PhysXPlatform::Update(_float fTimeDelta) { + if (m_pGameInstance->Key_Pressing(DIK_I)) { + m_pRigidBody->Add_Force(XMVectorSet(0.f, 0.f, 1.f, 0.f) * m_pTransformCom->Get_Speed() * fTimeDelta, PSX::PxForceMode::eACCELERATION); + } + if (m_pGameInstance->Key_Pressing(DIK_J)) { + m_pRigidBody->Add_Force(XMVectorSet(-1.f, 0.f, 0.f, 0.f) * m_pTransformCom->Get_Speed() * fTimeDelta, PSX::PxForceMode::eACCELERATION); + } + if (m_pGameInstance->Key_Pressing(DIK_K)) { + m_pRigidBody->Add_Force(XMVectorSet(0.f, 0.f, -1.f, 0.f) * m_pTransformCom->Get_Speed() * fTimeDelta, PSX::PxForceMode::eACCELERATION); + } + if (m_pGameInstance->Key_Pressing(DIK_L)) { + m_pRigidBody->Add_Force(XMVectorSet(1.f, 0.f, 0.f, 0.f) * m_pTransformCom->Get_Speed() * fTimeDelta, PSX::PxForceMode::eACCELERATION); + } } void CDummy_PhysXPlatform::Late_Update(_float fTimeDelta) @@ -76,7 +88,10 @@ HRESULT CDummy_PhysXPlatform::Render() HRESULT CDummy_PhysXPlatform::Ready_Components(void* pArg) { - if (FAILED(__super::Ready_Components(pArg))) { + CTransform::TRANSFORM_DESC Desc = { }; + Desc.fSpeedPerSec = 1000.f; + Desc.fRotationPerSec = XMConvertToDegrees(90.f); + if (FAILED(__super::Ready_Components(&Desc))) { return E_FAIL; } BOXSTARTPOS_DESC* pBox = static_cast(pArg); diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlatform.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlatform.h index 5b0f18846..4aa278346 100644 --- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlatform.h +++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlatform.h @@ -31,7 +31,7 @@ class CDummy_PhysXPlatform final : public CGameObject virtual HRESULT Render() override; private: - CRigidBody* m_pRigidBody = { nullptr }; + CRigidBody_Dynamic* m_pRigidBody = { nullptr }; const PSX::PxRigidDynamic* m_pActor = { nullptr }; CModel* m_pModelCom = { nullptr }; CShader* m_pShaderCom = { nullptr }; diff --git a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp index ce95cab67..80c6803f4 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp @@ -60,7 +60,7 @@ void CRigidBody_Dynamic::Add_Torque(_fvector vDirection, PSX::PxForceMode::Enum { PSX::PxVec3 vPxTorque = {}; XMStoreFloat3((_float3*)&vPxTorque, vDirection); - m_pRigidBody->addForce(vPxTorque, eType); + m_pRigidBody->addTorque(vPxTorque, eType); } void CRigidBody_Dynamic::Set_Kinematic(_bool bKinematic) @@ -118,14 +118,15 @@ HRESULT CRigidBody_Dynamic::Add_DebugShape() switch (m_eActorType) { case ACTOR::BOX: - m_pMainShape = (GeometricPrimitive::CreateBox(m_pContext, m_vhalfGeometryInfo, false, false)); + _float3 vDXGeometricSize = { m_vhalfGeometryInfo.x * 2.f, m_vhalfGeometryInfo.y * 2.f, m_vhalfGeometryInfo.z * 2.f }; + m_pMainShape = (GeometricPrimitive::CreateBox(m_pContext, vDXGeometricSize, false, false)); break; case ACTOR::CAPSULE: - m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, m_vhalfGeometryInfo.x, 10, false, false)); - m_pMainShape = (GeometricPrimitive::CreateCylinder(m_pContext, m_vhalfGeometryInfo.y, m_vhalfGeometryInfo.x, 10, false)); + m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, m_vhalfGeometryInfo.x * 2.f, 10, false, false)); + m_pMainShape = (GeometricPrimitive::CreateCylinder(m_pContext, m_vhalfGeometryInfo.y * 2.f, m_vhalfGeometryInfo.x * 2.f, 10, false)); break; case ACTOR::SPHERE: - m_pMainShape = (GeometricPrimitive::CreateSphere(m_pContext, m_vhalfGeometryInfo.x, 10, false, false)); + m_pMainShape = (GeometricPrimitive::CreateSphere(m_pContext, m_vhalfGeometryInfo.x * 2.f, 10, false, false)); break; default: break; From f99d0bc7abfd8d05ca39340e4f8817316913aae5 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Sat, 15 Nov 2025 18:14:46 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[add]=20=EC=82=AC=EB=8B=A4=EB=A6=AC=20?= =?UTF-8?q?=EC=99=84=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jusin154_Team3D/Editor/Default/Editor.vcxproj | 10 ++++- .../Private/CallBack_Playable_Behavior.cpp | 37 ++++++++++++++----- .../Private/CallBack_Playable_HitRepot.cpp | 31 ++++++++++++++-- .../Editor/Private/Dummy_PhysXBox.cpp | 8 ++-- .../Editor/Private/Dummy_PhysXDoor.cpp | 4 +- .../Editor/Private/Dummy_PhysXMesh.cpp | 6 +-- .../Editor/Private/Dummy_PhysXPlatform.cpp | 8 ++-- .../Editor/Private/Dummy_PhysXPlayable.cpp | 3 +- .../Editor/Private/Dummy_PhysXWall.cpp | 8 ++-- .../Editor/Private/Level_PhysXLab.cpp | 26 +++++++++---- .../Public/CallBack_Playable_Behavior.h | 8 +++- .../Public/CallBack_Playable_HitRepot.h | 9 ++++- .../Editor/Public/Dummy_PhysXBox.h | 7 ++-- .../Editor/Public/Dummy_PhysXDoor.h | 9 +++-- .../Editor/Public/Dummy_PhysXMesh.h | 4 +- .../Editor/Public/Dummy_PhysXPlatform.h | 9 +++-- .../Editor/Public/Dummy_PhysXPlayable.h | 9 +++-- .../Editor/Public/Dummy_PhysXWall.h | 9 +++-- .../Engine/Private/Character_Controller.cpp | 1 + Jusin154_Team3D/Engine/Private/RigidBody.cpp | 2 + .../Engine/Public/Character_Controller.h | 5 +-- Jusin154_Team3D/Engine/Public/Engine_Enum.h | 5 ++- Jusin154_Team3D/Engine/Public/RigidBody.h | 2 +- 23 files changed, 151 insertions(+), 69 deletions(-) diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 6977a8e9a..54d43be5c 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -198,7 +198,10 @@ - + + true + true + @@ -273,7 +276,10 @@ - + + true + true + diff --git a/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp b/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp index ef3c7179b..a248e45b2 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp @@ -3,8 +3,15 @@ #include "GameInstance.h" -CCallBack_Playable_Behavior::CCallBack_Playable_Behavior() +CCallBack_Playable_Behavior::CCallBack_Playable_Behavior(): + m_pGameInstance(CGameInstance::GetInstance()) { + SAFE_ADDREF(m_pGameInstance); +} + +CCallBack_Playable_Behavior::~CCallBack_Playable_Behavior() +{ + SAFE_RELEASE(m_pGameInstance); } PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(const PSX::PxShape& shape, const PSX::PxActor& actor) @@ -12,17 +19,31 @@ PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(con if (nullptr == actor.userData) { return PSX::PxControllerBehaviorFlags(0); } + PSX::PxControllerBehaviorFlags eResults = PSX::PxControllerBehaviorFlags(0); PhsXUserData* pActorData = static_cast(actor.userData); - switch (pActorData->eKind) { case PHYSX_KIND::BODY_STATIC: - return PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT - | PSX::PxControllerBehaviorFlag::eCCT_SLIDE; + eResults = PSX::PxControllerBehaviorFlag::eCCT_SLIDE | PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT; break; case PHYSX_KIND::BODY_DYNAMIC: - return PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT - | PSX::PxControllerBehaviorFlag::eCCT_SLIDE; + switch (pActorData->iSubKind) + { + case 20: + eResults = PSX::PxControllerBehaviorFlag::eCCT_SLIDE; + break; + case 21: + eResults = PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT; + break; + case 22: + eResults = PSX::PxControllerBehaviorFlag::eCCT_SLIDE | PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT; + break; + case 23: + eResults = PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT; + break; + default: + break; + } break; case PHYSX_KIND::CCTActor: // Action @@ -33,9 +54,7 @@ PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(con break; } - - // 나머지는 아무 특별 동작 없음 - return PSX::PxControllerBehaviorFlags(0); + return eResults; } PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(const PSX::PxController& controller) diff --git a/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitRepot.cpp b/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitRepot.cpp index 2d5bc81cc..6852be5e4 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitRepot.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitRepot.cpp @@ -1,9 +1,17 @@ #include "pch.h" #include "CallBack_Playable_HitRepot.h" #include "GameInstance.h" +#include "GameObject.h" -CCallBack_Playable_HitRepot::CCallBack_Playable_HitRepot() +CCallBack_Playable_HitRepot::CCallBack_Playable_HitRepot(): + m_pGameInstance(CGameInstance::GetInstance()) { + SAFE_ADDREF(m_pGameInstance); +} + +CCallBack_Playable_HitRepot::~CCallBack_Playable_HitRepot() +{ + SAFE_RELEASE(m_pGameInstance); } void CCallBack_Playable_HitRepot::onShapeHit(const PSX::PxControllerShapeHit& hit) @@ -18,17 +26,32 @@ void CCallBack_Playable_HitRepot::onShapeHit(const PSX::PxControllerShapeHit& hi PSX::PxRigidActor* pActor = hit.actor; if (nullptr != pController && nullptr != pActor) { - PhsXUserData* pActorData = static_cast(pActor->userData); - if (nullptr == pActorData) { // missing user data + PhsXUserData* pTargetActorData = static_cast(pActor->userData); + PhsXUserData* pOwnerActorData = static_cast(pController->getActor()->userData); + if (nullptr == pTargetActorData) { // missing user data return; } - switch (pActorData->eKind) + + switch (pTargetActorData->eKind) { case PHYSX_KIND::BODY_STATIC: // action break; case PHYSX_KIND::BODY_DYNAMIC: { + switch (pTargetActorData->iSubKind) + { + case 23: // 무거운데 올라갈 수 있는 벽 + if (m_pGameInstance->Key_Pressing(DIK_E)) { + pOwnerActorData->pOwner->Get_Component()->BookMomentum(fLength * XMVectorSet(0.f, 1.f, 0.f, 0.f)); + } + else if (m_pGameInstance->Key_Pressing(DIK_R)) { + pOwnerActorData->pOwner->Get_Component()->BookMomentum(fLength * XMVectorSet(0.f, -1.f, 0.f, 0.f)); + } + break; + default: + break; + } PSX::PxRigidDynamic* pDynamic = static_cast(pActor); pDynamic->addForce(vDir * fLength * 100000.f, PSX::PxForceMode::eIMPULSE); } break; diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp index a2fae363e..fe5b6e0d8 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp @@ -89,15 +89,15 @@ HRESULT CDummy_PhysXBox::Ready_Components(void* pArg) if (FAILED(__super::Ready_Components(pArg))) { return E_FAIL; } - BOXSTARTPOS_DESC* pBox = static_cast(pArg); + PHYSXDUMMY_DESC* pPhysXDummyDesc = static_cast(pArg); - m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pBox->vPos), 1.f)); - m_pTransformCom->Rotation(pBox->vRotRPY.x, pBox->vRotRPY.y, pBox->vRotRPY.z); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pPhysXDummyDesc->vPos), 1.f)); + m_pTransformCom->Rotation(pPhysXDummyDesc->vRotRPY.x, pPhysXDummyDesc->vRotRPY.y, pPhysXDummyDesc->vRotRPY.z); { // RIGID_BODY CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; - + Desc.iSubKind = pPhysXDummyDesc->iSubKind; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), (CComponent**)&m_pRigidBody, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoor.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoor.cpp index e68e35086..a46ff03a5 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoor.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoor.cpp @@ -79,7 +79,7 @@ HRESULT CDummy_PhysXDoor::Ready_Components(void* pArg) if (FAILED(__super::Ready_Components(pArg))) { return E_FAIL; } - BOXSTARTPOS_DESC* pBox = static_cast(pArg); + PHYSXDUMMY_DESC* pPhysXDummyDesc = static_cast(pArg); m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pBox->vPos), 1.f)); m_pTransformCom->Rotation(pBox->vRotRPY.x, pBox->vRotRPY.y, pBox->vRotRPY.z); @@ -87,7 +87,7 @@ HRESULT CDummy_PhysXDoor::Ready_Components(void* pArg) { // RIGID_BODY CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; - + Desc.iSubKind = pPhysXDummyDesc->iSubKind; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), (CComponent**)&m_pRigidBody, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp index c61904291..5b54b1435 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp @@ -88,10 +88,10 @@ HRESULT CDummy_PhysXMesh::Ready_Components(void* pArg) reinterpret_cast(&m_pShaderCom)))) return E_FAIL; - BOXSTARTPOS_DESC* pBox = static_cast(pArg); + PHYSXDUMMY_DESC* pPhysXDummyDesc = static_cast(pArg); - m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pBox->vPos), 1.f)); - m_pTransformCom->Rotation(pBox->vRotRPY.x, pBox->vRotRPY.y, pBox->vRotRPY.z); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pPhysXDummyDesc->vPos), 1.f)); + m_pTransformCom->Rotation(pPhysXDummyDesc->vRotRPY.x, pPhysXDummyDesc->vRotRPY.y, pPhysXDummyDesc->vRotRPY.z); if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_River_Col_Model"), (CComponent**)&m_pModelCom))) { return E_FAIL; diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlatform.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlatform.cpp index abe07be1c..fc5eb6447 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlatform.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlatform.cpp @@ -94,15 +94,15 @@ HRESULT CDummy_PhysXPlatform::Ready_Components(void* pArg) if (FAILED(__super::Ready_Components(&Desc))) { return E_FAIL; } - BOXSTARTPOS_DESC* pBox = static_cast(pArg); + PHYSXDUMMY_DESC* pPhysXDummyDesc = static_cast(pArg); - m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pBox->vPos), 1.f)); - m_pTransformCom->Rotation(pBox->vRotRPY.x, pBox->vRotRPY.y, pBox->vRotRPY.z); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pPhysXDummyDesc->vPos), 1.f)); + m_pTransformCom->Rotation(pPhysXDummyDesc->vRotRPY.x, pPhysXDummyDesc->vRotRPY.y, pPhysXDummyDesc->vRotRPY.z); { // RIGID_BODY CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; - + Desc.iSubKind = pPhysXDummyDesc->iSubKind; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_PLATFORM"), (CComponent**)&m_pRigidBody, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp index 4a0689dc2..ce7b8ac7e 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp @@ -112,12 +112,13 @@ HRESULT CDummy_PhysXPlayable::Ready_Components(void* pArg) if (FAILED(__super::Ready_Components(&TransformDesc))) { return E_FAIL; } - PlayableSTARTPOS_DESC* pDesc = static_cast(pArg); + PHYSXDUMMY_DESC* pDesc = static_cast(pArg); m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vPos), 1.f)); m_pTransformCom->Rotation(pDesc->vRotRPY.x, pDesc->vRotRPY.y, pDesc->vRotRPY.z); { CCharacter_Controller::Character_Controller_DESC Desc{}; + Desc.iSubKind = pDesc->iSubKind; Desc.pTransform = m_pTransformCom; Desc.eBodyType = ACTOR::CAPSULE; Desc.fContactOffset = 0.1f; diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXWall.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXWall.cpp index 8dcc4e0b0..0aca5cabe 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXWall.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXWall.cpp @@ -79,15 +79,15 @@ HRESULT CDummy_PhysXWall::Ready_Components(void* pArg) if (FAILED(__super::Ready_Components(pArg))) { return E_FAIL; } - BOXSTARTPOS_DESC* pBox = static_cast(pArg); + PHYSXDUMMY_DESC* pPhysXDummyDesc = static_cast(pArg); - m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pBox->vPos), 1.f)); - m_pTransformCom->Rotation(pBox->vRotRPY.x, pBox->vRotRPY.y, pBox->vRotRPY.z); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pPhysXDummyDesc->vPos), 1.f)); + m_pTransformCom->Rotation(pPhysXDummyDesc->vRotRPY.x, pPhysXDummyDesc->vRotRPY.y, pPhysXDummyDesc->vRotRPY.z); { // RIGID_BODY CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; - + Desc.iSubKind = pPhysXDummyDesc->iSubKind; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), (CComponent**)&m_pRigidBody, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp index 11140c5c7..e2d854245 100644 --- a/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp @@ -95,43 +95,55 @@ HRESULT CLevel_PhysXLab::Ready_Layer_Terrain(const _wstring& strLayerTag) HRESULT CLevel_PhysXLab::Ready_Layer_PhysXObjects(const _wstring& strLayerTag) { for (int i = 0; i < 10; ++i) { - CDummy_PhysXBox::BOXSTARTPOS_DESC Desc{}; + CDummy_PhysXBox::PHYSXDUMMY_DESC Desc{}; Desc.vPos = { m_pGameInstance->Random_Float(0.f, 30.f), m_pGameInstance->Random_Float(3.f, 33.f), m_pGameInstance->Random_Float(0.f, 30.f) }; Desc.vRotRPY = { m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI) }; + Desc.iSubKind = 0; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { return E_FAIL; } } { - CDummy_PhysXWall::BOXSTARTPOS_DESC Desc{}; + CDummy_PhysXWall::PHYSXDUMMY_DESC Desc{}; Desc.vPos = { -15.f, 3.f, 15.f }; Desc.vRotRPY = { 0.f, m_pGameInstance->Random_Float(0.f, XM_2PI), 0.f }; + Desc.iSubKind = 23; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { return E_FAIL; } } { - CDummy_PhysXPlatform::BOXSTARTPOS_DESC Desc{}; - Desc.vPos = { 0.f, 2.f, 10.f }; + CDummy_PhysXPlatform::PHYSXDUMMY_DESC Desc{}; + Desc.vPos = { -1.f, 2.f, 10.f }; Desc.vRotRPY = { 0.f, m_pGameInstance->Random_Float(0.f, XM_2PI), 0.f }; - + Desc.iSubKind = 20; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { return E_FAIL; } } { - CDummy_PhysXPlayable::PlayableSTARTPOS_DESC Desc{}; + CDummy_PhysXPlatform::PHYSXDUMMY_DESC Desc{}; + Desc.vPos = { 0.f, 2.f, 10.f }; + Desc.vRotRPY = { 0.f, m_pGameInstance->Random_Float(0.f, XM_2PI), 0.f }; + Desc.iSubKind = 21; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { + return E_FAIL; + } + } + { + CDummy_PhysXPlayable::PHYSXDUMMY_DESC Desc{}; Desc.vPos = { 0.f, 100.f, 0.f }; Desc.vRotRPY = { 0.f, 0.f, 0.f }; + Desc.iSubKind = 10; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_PLAYER, &Desc))) { return E_FAIL; } } //{ - // CDummy_PhysXMesh::BOXSTARTPOS_DESC Desc{}; + // CDummy_PhysXMesh::PHYSXDUMMY_DESC Desc{}; // Desc.vPos = { 0.f, 10.f, 0.f }; // Desc.vRotRPY = { 0.f, 0.f, 0.f }; // if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CHUNK, &Desc))) { diff --git a/Jusin154_Team3D/Editor/Public/CallBack_Playable_Behavior.h b/Jusin154_Team3D/Editor/Public/CallBack_Playable_Behavior.h index 67bec0771..cbb0aba6c 100644 --- a/Jusin154_Team3D/Editor/Public/CallBack_Playable_Behavior.h +++ b/Jusin154_Team3D/Editor/Public/CallBack_Playable_Behavior.h @@ -2,6 +2,10 @@ #include "Editor_Define.h" +NS_BEGIN(Engine) +class CGameInstance; +NS_END + NS_BEGIN(Editor) class CCallBack_Playable_Behavior final : public PSX::PxControllerBehaviorCallback @@ -15,7 +19,7 @@ class CCallBack_Playable_Behavior final : public PSX::PxControllerBehaviorCallba public: CCallBack_Playable_Behavior(); - ~CCallBack_Playable_Behavior() = default; + ~CCallBack_Playable_Behavior(); public: // PxControllerBehaviorCallback을(를) 통해 상속됨 @@ -27,5 +31,7 @@ class CCallBack_Playable_Behavior final : public PSX::PxControllerBehaviorCallba virtual PSX::PxControllerBehaviorFlags getBehaviorFlags(const PSX::PxController& controller) override; virtual PSX::PxControllerBehaviorFlags getBehaviorFlags(const PSX::PxObstacle& obstacle) override; +private: + CGameInstance* m_pGameInstance = { nullptr }; }; NS_END diff --git a/Jusin154_Team3D/Editor/Public/CallBack_Playable_HitRepot.h b/Jusin154_Team3D/Editor/Public/CallBack_Playable_HitRepot.h index de402f1f0..b6bb6004a 100644 --- a/Jusin154_Team3D/Editor/Public/CallBack_Playable_HitRepot.h +++ b/Jusin154_Team3D/Editor/Public/CallBack_Playable_HitRepot.h @@ -2,6 +2,10 @@ #include "Editor_Define.h" +NS_BEGIN(Engine) +class CGameInstance; +NS_END + NS_BEGIN(Editor) class CCallBack_Playable_HitRepot final : public PSX::PxUserControllerHitReport @@ -15,7 +19,7 @@ class CCallBack_Playable_HitRepot final : public PSX::PxUserControllerHitReport public: CCallBack_Playable_HitRepot(); - ~CCallBack_Playable_HitRepot() = default; + ~CCallBack_Playable_HitRepot(); public: // PxUserControllerHitReport을(를) 통해 상속됨 @@ -26,5 +30,8 @@ class CCallBack_Playable_HitRepot final : public PSX::PxUserControllerHitReport virtual void onControllerHit(const PSX::PxControllersHit& hit) override; // 다른 CCT와 부딪힌 경우 virtual void onObstacleHit(const PSX::PxControllerObstacleHit& hit) override; // 사용자 정의 장애물과 부딪힌 경우 + +private: + CGameInstance* m_pGameInstance = { nullptr }; }; NS_END diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXBox.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXBox.h index cf2d7f4bb..71ee9bc09 100644 --- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXBox.h +++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXBox.h @@ -14,11 +14,12 @@ NS_BEGIN(Editor) class CDummy_PhysXBox final : public CGameObject { public: - typedef struct tagBoxStartPos + typedef struct tagPhysXDummyDesc { _float3 vPos = {}; _float3 vRotRPY = {}; - }BOXSTARTPOS_DESC; + _uint iSubKind = {}; + }PHYSXDUMMY_DESC; private: CDummy_PhysXBox(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CDummy_PhysXBox(const CDummy_PhysXBox& rhs); @@ -50,4 +51,4 @@ class CDummy_PhysXBox final : public CGameObject void Describe_Entity() override; }; -NS_END \ No newline at end of file +NS_END diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoor.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoor.h index 790a32a5a..e90d185a0 100644 --- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoor.h +++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoor.h @@ -14,11 +14,12 @@ NS_BEGIN(Editor) class CDummy_PhysXDoor final : public CGameObject { public: - typedef struct tagBoxStartPos + typedef struct tagPhysXDummyDesc { - _float3 vPos = {}; - _float3 vRotRPY = {}; - }BOXSTARTPOS_DESC; + _float3 vPos = { }; + _float3 vRotRPY = { }; + _uint iSubKind = { }; + }PHYSXDUMMY_DESC; private: CDummy_PhysXDoor(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CDummy_PhysXDoor(const CDummy_PhysXDoor& rhs); diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXMesh.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXMesh.h index 06fc3e4ea..4aaa3edf1 100644 --- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXMesh.h +++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXMesh.h @@ -14,11 +14,11 @@ NS_BEGIN(Editor) class CDummy_PhysXMesh final : public CGameObject { public: - typedef struct tagBoxStartPos + typedef struct tagPhysXDummyDesc { _float3 vPos = {}; _float3 vRotRPY = {}; - }BOXSTARTPOS_DESC; + }PHYSXDUMMY_DESC; private: CDummy_PhysXMesh(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CDummy_PhysXMesh(const CDummy_PhysXMesh& rhs); diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlatform.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlatform.h index 4aa278346..dfa3f4223 100644 --- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlatform.h +++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlatform.h @@ -14,11 +14,12 @@ NS_BEGIN(Editor) class CDummy_PhysXPlatform final : public CGameObject { public: - typedef struct tagBoxStartPos + typedef struct tagPhysXDummyDesc { - _float3 vPos = {}; - _float3 vRotRPY = {}; - }BOXSTARTPOS_DESC; + _float3 vPos = { }; + _float3 vRotRPY = { }; + _uint iSubKind = { }; + }PHYSXDUMMY_DESC; private: CDummy_PhysXPlatform(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CDummy_PhysXPlatform(const CDummy_PhysXPlatform& rhs); diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h index 611c5582c..2dba3e944 100644 --- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h +++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h @@ -16,11 +16,12 @@ NS_BEGIN(Editor) class CDummy_PhysXPlayable final : public CGameObject { public: - typedef struct tagPlayableStartPos + typedef struct tagPhysXDummyDesc { - _float3 vPos = {}; - _float3 vRotRPY = {}; - }PlayableSTARTPOS_DESC; + _float3 vPos = { }; + _float3 vRotRPY = { }; + _uint iSubKind = { }; + }PHYSXDUMMY_DESC; private: CDummy_PhysXPlayable(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CDummy_PhysXPlayable(const CDummy_PhysXPlayable& rhs); diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXWall.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXWall.h index 0fed90293..5fb74604f 100644 --- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXWall.h +++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXWall.h @@ -14,11 +14,12 @@ NS_BEGIN(Editor) class CDummy_PhysXWall final : public CGameObject { public: - typedef struct tagBoxStartPos + typedef struct tagPhysXDummyDesc { - _float3 vPos = {}; - _float3 vRotRPY = {}; - }BOXSTARTPOS_DESC; + _float3 vPos = { }; + _float3 vRotRPY = { }; + _uint iSubKind = { }; + }PHYSXDUMMY_DESC; private: CDummy_PhysXWall(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CDummy_PhysXWall(const CDummy_PhysXWall& rhs); diff --git a/Jusin154_Team3D/Engine/Private/Character_Controller.cpp b/Jusin154_Team3D/Engine/Private/Character_Controller.cpp index 063012895..6ad96c47c 100644 --- a/Jusin154_Team3D/Engine/Private/Character_Controller.cpp +++ b/Jusin154_Team3D/Engine/Private/Character_Controller.cpp @@ -195,6 +195,7 @@ HRESULT CCharacter_Controller::Initialize(void* pArg) m_tagData.pOwner = m_pOwner; XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix()); m_tagData.pCharacter = this; + m_tagData.iSubKind = pDesc->iSubKind; } switch (m_eBodyType) diff --git a/Jusin154_Team3D/Engine/Private/RigidBody.cpp b/Jusin154_Team3D/Engine/Private/RigidBody.cpp index 8589650a7..77b64bf77 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody.cpp @@ -29,6 +29,8 @@ HRESULT CRigidBody::Initialize(void* pArg) m_pTransform = m_pOwner->Get_Component(); SAFE_ADDREF(m_pTransform); + m_tagData.iSubKind = pDesc->iSubKind; + return S_OK; } diff --git a/Jusin154_Team3D/Engine/Public/Character_Controller.h b/Jusin154_Team3D/Engine/Public/Character_Controller.h index 99efd0a8d..839e270c1 100644 --- a/Jusin154_Team3D/Engine/Public/Character_Controller.h +++ b/Jusin154_Team3D/Engine/Public/Character_Controller.h @@ -12,9 +12,6 @@ class ENGINE_DLL CCharacter_Controller final : // kinematic 기반임 public: #pragma region STRUCT - struct CapsuleInfo - { - }; typedef struct tagCharacter_ControllerDesc { CTransform* pTransform = { nullptr }; @@ -23,7 +20,7 @@ class ENGINE_DLL CCharacter_Controller final : _float3 fMaterial = { 0.5f, 0.5f, 0.6f }; _bool bAutoStepping = { false }; // 계단 높이 타게 할건지 // 박스 콜라이더는 생각한대로 되는데 캡슐은 바닥의 구체 때문에 예상보다 더 높은 곳까지 오를 수 있음 _float fStepOffset = { 0.05f }; // 허용가능한 계단 높이, 작게 유지하는게 좋음 - + _uint iSubKind = { }; PSX::PxUserControllerHitReport* pCallback_HitReport = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함 PSX::PxControllerBehaviorCallback* pCallback_Behavior = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함 diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h index 32fb7e138..ea9ef2e51 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h @@ -20,7 +20,10 @@ enum class PXMATERIAL { DEFAULT, END, }; - +enum class PXBODYSTATE { + DYNAMIC, + KINEMATIC, +}; enum class MOUSEKEYSTATE { LBUTTON, RBUTTON, WBUTTON, XBUTTON }; enum class MOUSEMOVESTATE { X, Y, W }; diff --git a/Jusin154_Team3D/Engine/Public/RigidBody.h b/Jusin154_Team3D/Engine/Public/RigidBody.h index 803574e02..b7007ca27 100644 --- a/Jusin154_Team3D/Engine/Public/RigidBody.h +++ b/Jusin154_Team3D/Engine/Public/RigidBody.h @@ -26,7 +26,7 @@ class ENGINE_DLL CRigidBody abstract : public CComponent typedef struct tagRigidBody_Desc { - + _uint iSubKind = { }; }RIGIDBODY_DESC; protected: From 5644a9bfd5efa8a9419b837ab3b3b42db4dfe9fb Mon Sep 17 00:00:00 2001 From: kimnuri Date: Sat, 15 Nov 2025 21:57:13 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[add]=20=EB=AC=B8=EC=A7=9D=20=ED=94=BC?= =?UTF-8?q?=EB=B2=97=20=ED=9A=8C=EC=A0=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jusin154_Team3D/Editor/Default/Editor.vcxproj | 8 ++--- .../Private/CallBack_Playable_Behavior.cpp | 3 ++ .../Private/CallBack_Playable_HitRepot.cpp | 23 +++++++++--- .../Editor/Private/Dummy_PhysXDoor.cpp | 16 ++++++--- .../Editor/Private/Dummy_PhysXPlayable.cpp | 2 +- .../Editor/Private/Level_PhysXLab.cpp | 14 ++++++-- Jusin154_Team3D/Editor/Private/Loader.cpp | 36 +++++++++++++++++-- .../Editor/Public/Dummy_PhysXDoor.h | 5 +-- 8 files changed, 87 insertions(+), 20 deletions(-) diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 54d43be5c..2eed97a28 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -199,8 +199,8 @@ - true - true + false + false @@ -277,8 +277,8 @@ - true - true + false + false diff --git a/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp b/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp index a248e45b2..eb83a001e 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_Playable_Behavior.cpp @@ -41,6 +41,9 @@ PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(con case 23: eResults = PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT; break; + case 24: + eResults = PSX::PxControllerBehaviorFlags(0);; + break; default: break; } diff --git a/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitRepot.cpp b/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitRepot.cpp index 6852be5e4..9363fe59d 100644 --- a/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitRepot.cpp +++ b/Jusin154_Team3D/Editor/Private/CallBack_Playable_HitRepot.cpp @@ -43,17 +43,32 @@ void CCallBack_Playable_HitRepot::onShapeHit(const PSX::PxControllerShapeHit& hi { case 23: // 무거운데 올라갈 수 있는 벽 if (m_pGameInstance->Key_Pressing(DIK_E)) { - pOwnerActorData->pOwner->Get_Component()->BookMomentum(fLength * XMVectorSet(0.f, 1.f, 0.f, 0.f)); + pOwnerActorData->pOwner->Get_Component()->BookMomentum(fLength * XMVectorSet(0.f, 1.5f, 0.f, 0.f)); } else if (m_pGameInstance->Key_Pressing(DIK_R)) { pOwnerActorData->pOwner->Get_Component()->BookMomentum(fLength * XMVectorSet(0.f, -1.f, 0.f, 0.f)); } + //pOwnerActorData->pOwner->Get_Component()->BookMomentum(XMVectorSet(0.f, 0.5f * GRAVITY, 0.f, 0.f)); break; + case 24: // 문짝 + { + PSX::PxRigidDynamic* pDynamic = static_cast(pActor); + pDynamic->addTorque(vDir * fLength * 100000.f, PSX::PxForceMode::eIMPULSE); + _float fDot = vDir.dot(PSX::PxVec3(0.f, 1.f, 0.f)); + if (fDot > 0) { + pDynamic->addTorque(PSX::PxVec3(0.f, 1.f, 0.f) * fLength * 100000.f, PSX::PxForceMode::eIMPULSE); + } + else { + pDynamic->addTorque(PSX::PxVec3(0.f, -1.f, 0.f) * fLength * 100000.f, PSX::PxForceMode::eIMPULSE); + } + } break; default: + { + PSX::PxRigidDynamic* pDynamic = static_cast(pActor); + pDynamic->addForce(vDir * fLength * 100000.f, PSX::PxForceMode::eIMPULSE); + } break; } - PSX::PxRigidDynamic* pDynamic = static_cast(pActor); - pDynamic->addForce(vDir * fLength * 100000.f, PSX::PxForceMode::eIMPULSE); } break; case PHYSX_KIND::CCTActor: assert(false); @@ -101,7 +116,7 @@ void CCallBack_Playable_HitRepot::onControllerHit(const PSX::PxControllersHit& h void CCallBack_Playable_HitRepot::onObstacleHit(const PSX::PxControllerObstacleHit& hit) { - PSX::PxController* pController = hit.controller; + PSX::PxController* pController = hit.controller; PSX::PxExtendedVec3 vWorldPos = hit.worldPos; // 접촉지점 PSX::PxVec3 vWorldNormal = hit.worldNormal; // 접촉노말 PSX::PxVec3 vDir = hit.dir; // 시도한 move 방향 diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoor.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoor.cpp index a46ff03a5..0f2a6646e 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoor.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXDoor.cpp @@ -39,6 +39,12 @@ void CDummy_PhysXDoor::Priority_Update(_float fTimeDelta) void CDummy_PhysXDoor::Update(_float fTimeDelta) { +#ifdef 기무리 + //if (m_pActor->is wakeup) + // _vector vRPY = m_pTransformCom->Get_RollPitchYawVector(); + //_float fRadian = XMConvertToRadians(XMVectorGetZ(vRPY)); + //if (tanf(fRadian) +#endif // 기무리 } void CDummy_PhysXDoor::Late_Update(_float fTimeDelta) @@ -81,14 +87,17 @@ HRESULT CDummy_PhysXDoor::Ready_Components(void* pArg) } PHYSXDUMMY_DESC* pPhysXDummyDesc = static_cast(pArg); - m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pBox->vPos), 1.f)); - m_pTransformCom->Rotation(pBox->vRotRPY.x, pBox->vRotRPY.y, pBox->vRotRPY.z); + m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pPhysXDummyDesc->vPos), 1.f)); + m_pTransformCom->Rotation(pPhysXDummyDesc->vRotRPY.x, pPhysXDummyDesc->vRotRPY.y, pPhysXDummyDesc->vRotRPY.z); + m_vRadianYAngle.y = pPhysXDummyDesc->vRotRPY.y; + m_vRadianYAngle.x = m_vRadianYAngle.y + XMConvertToRadians(-70.f); + m_vRadianYAngle.z = m_vRadianYAngle.y + XMConvertToRadians(70.f); { // RIGID_BODY CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; Desc.iSubKind = pPhysXDummyDesc->iSubKind; - if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), (CComponent**)&m_pRigidBody, &Desc))) { + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_DOOR"), (CComponent**)&m_pRigidBody, &Desc))) { return E_FAIL; } } @@ -103,7 +112,6 @@ HRESULT CDummy_PhysXDoor::Ready_Components(void* pArg) return E_FAIL; } - return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp index ce7b8ac7e..dd0c7a961 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp @@ -108,7 +108,7 @@ HRESULT CDummy_PhysXPlayable::Ready_Components(void* pArg) CTransform::TRANSFORM_DESC TransformDesc{}; TransformDesc.fRadius = 100.f; TransformDesc.fRotationPerSec = XMConvertToRadians(60.f); - TransformDesc.fSpeedPerSec = 30.f; + TransformDesc.fSpeedPerSec = 15.f; if (FAILED(__super::Ready_Components(&TransformDesc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp index e2d854245..86513d203 100644 --- a/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp @@ -10,6 +10,7 @@ #include "Dummy_PhysXMesh.h" #include "Dummy_PhysXWall.h" #include "Dummy_PhysXPlatform.h" +#include "Dummy_PhysXDoor.h" #include "MapObject_Manager.h" #include "BuildingContainer.h" #include "MainLight.h" @@ -116,7 +117,7 @@ HRESULT CLevel_PhysXLab::Ready_Layer_PhysXObjects(const _wstring& strLayerTag) } { CDummy_PhysXPlatform::PHYSXDUMMY_DESC Desc{}; - Desc.vPos = { -1.f, 2.f, 10.f }; + Desc.vPos = { -3.f, 2.f, 10.f }; Desc.vRotRPY = { 0.f, m_pGameInstance->Random_Float(0.f, XM_2PI), 0.f }; Desc.iSubKind = 20; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { @@ -125,13 +126,22 @@ HRESULT CLevel_PhysXLab::Ready_Layer_PhysXObjects(const _wstring& strLayerTag) } { CDummy_PhysXPlatform::PHYSXDUMMY_DESC Desc{}; - Desc.vPos = { 0.f, 2.f, 10.f }; + Desc.vPos = { 0.f, 2.f, 8.f }; Desc.vRotRPY = { 0.f, m_pGameInstance->Random_Float(0.f, XM_2PI), 0.f }; Desc.iSubKind = 21; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { return E_FAIL; } } + { + CDummy_PhysXDoor::PHYSXDUMMY_DESC Desc{}; + Desc.vPos = { 10.f, 2.f, 10.f }; + Desc.vRotRPY = { 0.f, m_pGameInstance->Random_Float(0.f, XM_2PI), 0.f }; + Desc.iSubKind = 24; + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { + return E_FAIL; + } + } { CDummy_PhysXPlayable::PHYSXDUMMY_DESC Desc{}; Desc.vPos = { 0.f, 100.f, 0.f }; diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 66ed11788..f47989cd9 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -75,6 +75,7 @@ #include "Dummy_PhysXPlayable.h" #include "Dummy_PhysXMesh.h" #include "Dummy_PhysXPlatform.h" +#include "Dummy_PhysXDoor.h" #include "Dummy_PhysXWall.h" #pragma endregion @@ -588,8 +589,36 @@ HRESULT CLoader::Loading_For_PhysXLevel() return E_FAIL; } } + { // Door + CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{}; + { + Desc.eType = ACTOR::BOX; + Desc.ePxRigidBodyFlags = { /*PSX::PxRigidBodyFlag::eKINEMATIC*/ }; + Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; + Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT }; + Desc.vMatInfo = { 0.5f, 0.5f, 0.6f }; + Desc.fContactOffset = { 0.05f }; + Desc.vhalfGeometryInfo = { 1.5f, 1.5f, 0.0625f }; + Desc.fDensity = 100.f; + PSX::PxTransform pxPivotTransform = PSX::PxTransform(PSX::PxVec3(1.5f, 1.5f, 0.f)); - { + Desc.pxMassCenter = pxPivotTransform; + Desc.eLockFlag = { + PSX::PxRigidDynamicLockFlag::eLOCK_ANGULAR_X | + //PSX::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y | + PSX::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z | + PSX::PxRigidDynamicLockFlag::eLOCK_LINEAR_Y | + PSX::PxRigidDynamicLockFlag::eLOCK_LINEAR_X | + PSX::PxRigidDynamicLockFlag::eLOCK_LINEAR_Z + }; + Desc.vAutoDamping = { 10.f, 10.f }; + } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_DOOR"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { + return E_FAIL; + } + } + + { if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), CCharacter_Controller::Create(m_pDevice, m_pContext)))) { return E_FAIL; } @@ -687,6 +716,9 @@ HRESULT CLoader::Loading_For_PhysXLevel() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXBox::Create(m_pDevice, m_pContext)))) { return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXDoor::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXPlayable::Create(m_pDevice, m_pContext)))){ return E_FAIL; } @@ -699,11 +731,9 @@ HRESULT CLoader::Loading_For_PhysXLevel() if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_PhysXPlatform::Create(m_pDevice, m_pContext)))){ return E_FAIL; } - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_Collision::Create(m_pDevice, m_pContext)))){ return E_FAIL; } - if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CMapObject_LOD::Create(m_pDevice, m_pContext)))){ return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoor.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoor.h index e90d185a0..fcc9cc9fd 100644 --- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoor.h +++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXDoor.h @@ -34,8 +34,9 @@ class CDummy_PhysXDoor final : public CGameObject private: CRigidBody* m_pRigidBody = { nullptr }; const PSX::PxRigidDynamic* m_pActor = { nullptr }; - CModel* m_pModelCom = { nullptr }; - CShader* m_pShaderCom = { nullptr }; + CModel* m_pModelCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; + _float3 m_vRadianYAngle = {}; private: