[add] 일단 망토답게 만듬
This commit is contained in:
@@ -1769,9 +1769,9 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
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.001f };
|
||||
Desc.fContactOffset = { 0.1f };
|
||||
Desc.vhalfGeometryInfo = { 0.055f, 0.055f, 0.055f };
|
||||
Desc.fDensity = 100.f;
|
||||
Desc.fContactOffset = { 0.005f };
|
||||
Desc.vhalfGeometryInfo = { 0.025f, 0.025f, 0.025f };
|
||||
Desc.fDensity = 0.01f;
|
||||
Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY());
|
||||
Desc.eLockFlag = {};
|
||||
Desc.vAutoDamping = { 12.f, 12.f };
|
||||
@@ -1788,9 +1788,9 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
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.001f };
|
||||
Desc.fContactOffset = { 0.1f };
|
||||
Desc.vhalfGeometryInfo = { 0.035f, 0.15f, 0.f };
|
||||
Desc.fDensity = 100.f;
|
||||
Desc.fContactOffset = { 0.005f };
|
||||
Desc.vhalfGeometryInfo = { 0.025f, 0.075f, 0.f };
|
||||
Desc.fDensity = 0.01f;
|
||||
Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY());
|
||||
Desc.eLockFlag = {};
|
||||
Desc.vAutoDamping = { 12.f, 12.f };
|
||||
|
||||
@@ -17,9 +17,9 @@ void CPlayerRobe::Priority_Update(_float fTimeDelta)
|
||||
|
||||
void CPlayerRobe::Update(_float fTimeDelta)
|
||||
{
|
||||
_matrix OwnerMatrix = XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr());
|
||||
m_pTransformCom->Set_WorldMatrix(OwnerMatrix);
|
||||
m_pRobeMainAnchor->Move_Kinematic(XMLoadFloat4x4(m_pSocketMatrix) * OwnerMatrix, false);
|
||||
_matrix SocketMatrixFixed = (XMMatrixRotationZ(XM_PI) * XMLoadFloat4x4(m_pSocketMatrix)) *
|
||||
XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr());
|
||||
m_pRobeMainAnchor->Move_Kinematic(SocketMatrixFixed, false);
|
||||
m_pRobeMainAnchor->Get_Actor()->wakeUp();
|
||||
Update_LegsPosition();
|
||||
}
|
||||
@@ -34,6 +34,24 @@ void CPlayerRobe::Late_Update(_float fTimeDelta)
|
||||
if (true == bBroken) {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
const PSX::PxU32 shapeCount = m_pRobeJointRoute[i]->Get_Actor()->getNbShapes();
|
||||
std::vector<PSX::PxShape*> shapePointerArray(shapeCount, nullptr);
|
||||
|
||||
// (out) shapePointerArray에 shape 포인터들이 채워짐
|
||||
const PSX::PxU32 writtenCount = m_pRobeJointRoute[i]->Get_Actor()->getShapes(shapePointerArray.data(), shapeCount);
|
||||
|
||||
for (PSX::PxU32 shapeIndex = 0; shapeIndex < writtenCount; ++shapeIndex) {
|
||||
PSX::PxShape* shapePointer = shapePointerArray[shapeIndex];
|
||||
if (shapePointer == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
PSX::PxTransform shapeLocalPose = shapePointer->getLocalPose();
|
||||
shapeLocalPose.p;
|
||||
shapeLocalPose.q;
|
||||
// 여기서 shapeLocalPose.p / shapeLocalPose.q 를 찍어서 확인
|
||||
}
|
||||
}
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this);
|
||||
#endif // _DEBUG
|
||||
@@ -53,16 +71,24 @@ HRESULT CPlayerRobe::Update_RobeSocketPosition()
|
||||
|
||||
HRESULT CPlayerRobe::Helper_RouteJointGenerater(CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC& Desc_Body, ROUTE_DESC& Desc_Route, _matrix* xmAnchorMatricesWorld)
|
||||
{
|
||||
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_JOINT_ROUTE"), (CComponent**)&m_pRobeJointRoute[Desc_Route.iTargetRouteIndex], &Desc_Body))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_CenterTransform(xmAnchorMatricesWorld[Desc_Route.iStartBoneIndex].r[3], xmAnchorMatricesWorld[Desc_Route.iEndBoneIndex].r[3], true);
|
||||
{ // Joint
|
||||
assert(!m_pDynamicJoints[Desc_Route.iStartJointIndex]);
|
||||
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(m_pRobeJointAnchor[Desc_Route.iStartBoneIndex]->Get_Actor(), m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(), m_pRobeJointAnchor[Desc_Route.iStartBoneIndex]->Get_GlobalPosition());
|
||||
assert(!m_pDynamicJoints[Desc_Route.iEndJointIndex]);
|
||||
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(), m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor(), m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_GlobalPosition());
|
||||
}
|
||||
|
||||
|
||||
PSX::PxRigidDynamic* startAnchorRigidActor = m_pRobeJointAnchor[Desc_Route.iStartBoneIndex]->Get_Actor();
|
||||
PSX::PxRigidDynamic* routeRigidActor = m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor();
|
||||
PSX::PxRigidDynamic* endAnchorRigidActor = m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor();
|
||||
|
||||
PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y--
|
||||
PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++
|
||||
|
||||
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
|
||||
|
||||
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -109,13 +135,6 @@ HRESULT CPlayerRobe::Update_LegsPosition()
|
||||
#endif // _DEBUG
|
||||
}
|
||||
|
||||
//_matrix PreTransformMatrix = XMLoadFloat4x4(&m_PreTransformMatrix);
|
||||
//_matrix SocketMatrix = {};
|
||||
//for (_uint i = ENUM_CLASS(PLAYER_JOINT_ORDER::RUP_TO_RMIDDLE_START); i < ENUM_CLASS(PLAYER_JOINT_ORDER::END); ++i) {
|
||||
// SocketMatrix = XMLoadFloat4x4(m_RobeJointAnchorMatrices[(i - ENUM_CLASS(PLAYER_JOINT_ORDER::RUP_TO_RMIDDLE_START)) /2]);
|
||||
// m_pRobeJointAnchor[i]->Move_Kinematic((SocketMatrix * PreTransformMatrix * WorldMatrix));
|
||||
//}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -168,7 +187,6 @@ HRESULT CPlayerRobe::Render_BonePhysX()
|
||||
{
|
||||
_vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x00ff00, 1.f);
|
||||
_fmatrix OwnerMatrix = m_pParentTransformCom->Get_XMWorldMatrix();
|
||||
_matrix PreTransformMatrix = XMLoadFloat4x4(&m_PreTransformMatrix);
|
||||
_cmatrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW);
|
||||
_matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ);
|
||||
ID3D11DepthStencilState* pPrevDSS = nullptr;
|
||||
@@ -184,7 +202,7 @@ HRESULT CPlayerRobe::Render_BonePhysX()
|
||||
m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0);
|
||||
});
|
||||
}
|
||||
_matrix MainAnchorMatrix = XMLoadFloat4x4(m_pSocketMatrix) * OwnerMatrix;
|
||||
_matrix MainAnchorMatrix = /*XMMatrixRotationZ(XM_PIDIV2) * */XMLoadFloat4x4(m_pSocketMatrix) * OwnerMatrix;
|
||||
m_pSubShape->Draw(MainAnchorMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true,
|
||||
[this]() {
|
||||
m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0);
|
||||
@@ -194,13 +212,13 @@ HRESULT CPlayerRobe::Render_BonePhysX()
|
||||
});
|
||||
Render_Legs();
|
||||
_vector vRouteColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x0000ff, 1.f);
|
||||
for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::END); ++i) {
|
||||
if (nullptr != m_pRobeJointRoute[i]) {
|
||||
m_pRobeJointRoute[i]->Render([this]() {
|
||||
m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
//for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::END); ++i) {
|
||||
// if (nullptr != m_pRobeJointRoute[i]) {
|
||||
// m_pRobeJointRoute[i]->Render([this]() {
|
||||
// m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0);
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) {
|
||||
m_pRobeJointAnchor[i]->Render([this]() {
|
||||
m_pContext->OMSetDepthStencilState(m_pDepthStencilStateNone, 0);
|
||||
@@ -218,13 +236,10 @@ HRESULT CPlayerRobe::Ready_Components()
|
||||
{
|
||||
__super::Ready_Components(nullptr);
|
||||
|
||||
_matrix PreTransformMatrix = XMLoadFloat4x4(&m_PreTransformMatrix);
|
||||
_matrix parentWorld = m_pParentTransformCom->Get_XMWorldMatrix();
|
||||
_matrix socketMatrix = XMMatrixRotationZ(XMConvertToRadians(90.f)) * XMLoadFloat4x4(m_pSocketMatrix);
|
||||
_matrix socketWorld = socketMatrix * parentWorld;
|
||||
_matrix socketWorld = /*XMMatrixRotationZ(XM_PIDIV2) * */XMLoadFloat4x4(m_pSocketMatrix) * m_pParentTransformCom->Get_XMWorldMatrix();
|
||||
_matrix xmAnchorMatricesWorld[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { };
|
||||
for (_uint iBoneIndex = 0; iBoneIndex < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++iBoneIndex) {
|
||||
xmAnchorMatricesWorld[iBoneIndex] = XMLoadFloat4x4(m_RobeJointAnchorMatrices[iBoneIndex]) * PreTransformMatrix * parentWorld;
|
||||
xmAnchorMatricesWorld[iBoneIndex] = XMLoadFloat4x4(&m_ReconstructedJointAnchorMatirces[iBoneIndex]) * socketWorld;
|
||||
}
|
||||
|
||||
{ //
|
||||
@@ -293,8 +308,15 @@ HRESULT CPlayerRobe::Ready_Components()
|
||||
m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_Name("Origin_Linked_Routes");
|
||||
#endif // _DEBUG
|
||||
{ // Joint
|
||||
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(m_pRobeMainAnchor->Get_Actor(), m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(), m_pRobeMainAnchor->Get_GlobalPosition());
|
||||
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(), m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor(), m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_GlobalPosition());
|
||||
PSX::PxRigidDynamic* startAnchorRigidActor = m_pRobeMainAnchor->Get_Actor();
|
||||
PSX::PxRigidDynamic* routeRigidActor = m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor();
|
||||
PSX::PxRigidDynamic* endAnchorRigidActor = m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor();
|
||||
|
||||
PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y--
|
||||
PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++
|
||||
|
||||
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
|
||||
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
|
||||
}
|
||||
}
|
||||
{
|
||||
@@ -311,8 +333,15 @@ HRESULT CPlayerRobe::Ready_Components()
|
||||
m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_Name("Origin_Linked_Routes");
|
||||
#endif // _DEBUG
|
||||
{ // Joint
|
||||
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(m_pRobeMainAnchor->Get_Actor(), m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(), m_pRobeMainAnchor->Get_GlobalPosition());
|
||||
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(), m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor(), m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_GlobalPosition());
|
||||
PSX::PxRigidDynamic* startAnchorRigidActor = m_pRobeMainAnchor->Get_Actor();
|
||||
PSX::PxRigidDynamic* routeRigidActor = m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor();
|
||||
PSX::PxRigidDynamic* endAnchorRigidActor = m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor();
|
||||
|
||||
PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y--
|
||||
PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++
|
||||
|
||||
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
|
||||
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
|
||||
}
|
||||
}
|
||||
{
|
||||
@@ -329,8 +358,15 @@ HRESULT CPlayerRobe::Ready_Components()
|
||||
m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_Name("Origin_Linked_Routes");
|
||||
#endif // _DEBUG
|
||||
{ // Joint
|
||||
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(m_pRobeMainAnchor->Get_Actor(), m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(), m_pRobeMainAnchor->Get_GlobalPosition());
|
||||
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor(), m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor(), m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_GlobalPosition());
|
||||
PSX::PxRigidDynamic* startAnchorRigidActor = m_pRobeMainAnchor->Get_Actor();
|
||||
PSX::PxRigidDynamic* routeRigidActor = m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_Actor();
|
||||
PSX::PxRigidDynamic* endAnchorRigidActor = m_pRobeJointAnchor[Desc_Route.iEndBoneIndex]->Get_Actor();
|
||||
|
||||
PSX::PxTransform startJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), false); // start y--
|
||||
PSX::PxTransform endJointWorldPose = CMyTools::MakeJointWorldPoseFromRouteEnd(routeRigidActor, m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Get_HalfGeometryInfo(), true); // end y++
|
||||
|
||||
m_pDynamicJoints[Desc_Route.iStartJointIndex] = m_pGameInstance->Create_PxD6Joint(startAnchorRigidActor, routeRigidActor, startJointWorldPose);
|
||||
m_pDynamicJoints[Desc_Route.iEndJointIndex] = m_pGameInstance->Create_PxD6Joint(routeRigidActor, endAnchorRigidActor, endJointWorldPose);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,12 +468,63 @@ HRESULT CPlayerRobe::Initialize(void* pArg)
|
||||
m_pRightFootLocalMatrix = m_pModelCom->Get_BoneMatrixPtr("RightFoot");
|
||||
m_pRightLegLocalMatrix = m_pModelCom->Get_BoneMatrixPtr("RightLeg");
|
||||
|
||||
XMStoreFloat4x4(&m_PreTransformMatrix,
|
||||
XMMatrixRotationZ(XMConvertToRadians(90.f)) * XMLoadFloat4x4(m_pModelCom->Get_PreTransformMatrixPtr()));
|
||||
XMStoreFloat4x4(&m_PreTransformMatrix, XMLoadFloat4x4(m_pModelCom->Get_PreTransformMatrixPtr()));
|
||||
|
||||
for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) {
|
||||
m_RobeJointAnchorMatrices[i] = m_pModelCom->Get_BoneLocalMatrixPtr(PLAYER_JOINT_BONE_NAMES[i]);
|
||||
}
|
||||
for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i)
|
||||
{
|
||||
_uint iParentIndex = UINT_MAX;
|
||||
_bool bCopyPreTransform = false;
|
||||
|
||||
switch ((PLAYER_JOINT_BONE_ORDER)i)
|
||||
{
|
||||
case PLAYER_JOINT_BONE_ORDER::RIGHTUP:
|
||||
case PLAYER_JOINT_BONE_ORDER::TAILUP:
|
||||
case PLAYER_JOINT_BONE_ORDER::LEFTUP:
|
||||
bCopyPreTransform = true;
|
||||
break;
|
||||
|
||||
case PLAYER_JOINT_BONE_ORDER::RIGHT:
|
||||
iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHTUP);
|
||||
break;
|
||||
case PLAYER_JOINT_BONE_ORDER::TAIL:
|
||||
iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::TAILUP);
|
||||
break;
|
||||
case PLAYER_JOINT_BONE_ORDER::LEFT:
|
||||
iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::LEFTUP);
|
||||
break;
|
||||
case PLAYER_JOINT_BONE_ORDER::RIGHTDOWNRIGHT:
|
||||
case PLAYER_JOINT_BONE_ORDER::RIGHTDOWN:
|
||||
iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHT);
|
||||
break;
|
||||
case PLAYER_JOINT_BONE_ORDER::TAILRIGHTDOWN:
|
||||
case PLAYER_JOINT_BONE_ORDER::TAILLEFTDOWN:
|
||||
iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::TAIL);
|
||||
break;
|
||||
case PLAYER_JOINT_BONE_ORDER::LEFTDOWN:
|
||||
case PLAYER_JOINT_BONE_ORDER::LEFTDOWNLEFT:
|
||||
iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::LEFT);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
if (true == bCopyPreTransform)
|
||||
{
|
||||
_matrix constructedMatrix = XMLoadFloat4x4(m_RobeJointAnchorMatrices[i]) * XMLoadFloat4x4(&m_PreTransformMatrix);
|
||||
|
||||
XMStoreFloat4x4(&m_ReconstructedJointAnchorMatirces[i], constructedMatrix);
|
||||
continue;
|
||||
}
|
||||
|
||||
_matrix constructedMatrix = XMLoadFloat4x4(m_RobeJointAnchorMatrices[i])
|
||||
* XMLoadFloat4x4(&m_ReconstructedJointAnchorMatirces[iParentIndex]);
|
||||
|
||||
XMStoreFloat4x4(&m_ReconstructedJointAnchorMatirces[i], constructedMatrix);
|
||||
}
|
||||
|
||||
if (FAILED(__super::Initialize(pArg))) {
|
||||
return E_FAIL;
|
||||
|
||||
@@ -40,6 +40,7 @@ class CPlayerRobe final : public CPartObject
|
||||
const _float4x4* m_pRightFootLocalMatrix = { nullptr };
|
||||
const _float4x4* m_pRightLegLocalMatrix = { nullptr };
|
||||
const _float4x4* m_RobeJointAnchorMatrices[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { nullptr };
|
||||
_float4x4 m_ReconstructedJointAnchorMatirces[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { };
|
||||
|
||||
CModel* m_pModelCom = { nullptr };
|
||||
CRigidBody_Dynamic* m_pRightLeg = { nullptr };
|
||||
|
||||
@@ -52,9 +52,10 @@ enum class PLAYER_JOINT_BONE_ORDER {
|
||||
|
||||
, RIGHTDOWNRIGHT
|
||||
, RIGHTDOWN
|
||||
, TAILRIGHTDOWN
|
||||
|
||||
, TAILRIGHTDOWN
|
||||
, TAILLEFTDOWN
|
||||
|
||||
, LEFTDOWN
|
||||
, LEFTDOWNLEFT
|
||||
, END
|
||||
|
||||
@@ -36,6 +36,7 @@ PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidB
|
||||
case ACTOR::CAPSULE:
|
||||
geoHolder = PSX::PxCapsuleGeometry(vVolume.x, vVolume.y);
|
||||
pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActorDynamic, geoHolder.capsule(), *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
|
||||
FixCapsuleShapeAxisToY(pShape);
|
||||
break;
|
||||
case ACTOR::SPHERE:
|
||||
geoHolder = PSX::PxSphereGeometry(vVolume.x);
|
||||
@@ -59,6 +60,7 @@ PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidB
|
||||
|
||||
PSX::PxRigidBodyExt::updateMassAndInertia(*pActorDynamic, (PSX::PxReal)RigidBody.Get_Density());
|
||||
m_pRestBodies[iLevel].insert(pActorDynamic);
|
||||
pActorDynamic->userData = RigidBody.Get_UserDataPtr();
|
||||
ApplyFilterData(pActorDynamic);
|
||||
Attach_Actor(*pActorDynamic, iLevel);
|
||||
|
||||
@@ -185,8 +187,8 @@ PSX::PxD6Joint* CPhysX_Manager::Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, P
|
||||
|
||||
PSX::PxD6Joint* pJoint = PSX::PxD6JointCreate(*m_pPhysics, pActor0, pxLocalParentPOs, pActor1, pxLocalChildPos);
|
||||
|
||||
pActor0->setSolverIterationCounts(8, 2);
|
||||
pActor1->setSolverIterationCounts(8, 2);
|
||||
pActor0->setSolverIterationCounts(42, 6);
|
||||
pActor1->setSolverIterationCounts(42, 6);
|
||||
|
||||
pJoint->setMotion(PSX::PxD6Axis::eX, PSX::PxD6Motion::eLOCKED);
|
||||
pJoint->setMotion(PSX::PxD6Axis::eY, PSX::PxD6Motion::eLOCKED);
|
||||
@@ -195,10 +197,11 @@ PSX::PxD6Joint* CPhysX_Manager::Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, P
|
||||
pJoint->setMotion(PSX::PxD6Axis::eSWING1, PSX::PxD6Motion::eLIMITED);
|
||||
pJoint->setMotion(PSX::PxD6Axis::eSWING2, PSX::PxD6Motion::eLIMITED);
|
||||
|
||||
pJoint->setTwistLimit(PSX::PxJointAngularLimitPair(-0.35f, 0.35f)); // 20도
|
||||
pJoint->setSwingLimit(PSX::PxJointLimitCone(0.70f, 0.70f)); // 40도
|
||||
|
||||
pJoint->setDrive(PSX::PxD6Drive::eSLERP, PSX::PxD6JointDrive(500.0f, 100.0f, FLT_MAX, true));
|
||||
pJoint->setTwistLimit(PSX::PxJointAngularLimitPair(-0.35f, 0.35f)); // 20도
|
||||
pJoint->setSwingLimit(PSX::PxJointLimitCone(0.10f, 0.10f)); // 40도
|
||||
|
||||
pJoint->setDrive(PSX::PxD6Drive::eSLERP, PSX::PxD6JointDrive(50.0f, 10.0f, FLT_MAX, true));
|
||||
pJoint->setDrivePosition(PSX::PxTransform(PSX::PxIdentity)); //생성 시 프레임 기준
|
||||
//pJoint->setDrive(PSX::PxD6Drive::eSLERP, PSX::PxD6JointDrive(0.0f, 0.0f, 0.0f, false));
|
||||
|
||||
@@ -498,6 +501,16 @@ void CPhysX_Manager::Update_Dynamic_ActiveActors()
|
||||
}
|
||||
}
|
||||
|
||||
void CPhysX_Manager::FixCapsuleShapeAxisToY(PSX::PxShape* pShape)
|
||||
{
|
||||
PSX::PxTransform shapeLocalPose = pShape->getLocalPose();
|
||||
|
||||
// X -> Y : Z축 기준 +90도 회전
|
||||
shapeLocalPose.q = PSX::PxQuat(PSX::PxHalfPi, PSX::PxVec3(0.f, 0.f, 1.f)) * shapeLocalPose.q;
|
||||
|
||||
pShape->setLocalPose(shapeLocalPose);
|
||||
}
|
||||
|
||||
uint32_t CPhysX_Manager::ConvertPhysxKindToBit(const PHYSX_USERDATA& physxUserData)
|
||||
{
|
||||
if (physxUserData.eKind == PHYSX_KIND::BODY_STATIC)
|
||||
|
||||
@@ -39,7 +39,7 @@ HRESULT CRigidBody_Dynamic::Render(function<void()> custumState)
|
||||
} break;
|
||||
case ACTOR::CAPSULE:
|
||||
{
|
||||
WorldMatrix = XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMQuaternionMultiply(XMQuaternionRotationAxis(XMVectorSet(1.f, 0.f, 0.f, 0.f), XMConvertToRadians(90.f)), XMLoadFloat4((_float4*)&pxTranform.q)), XMVectorSetW(XMLoadFloat3((_float3*)&pxTranform.p), 1.f));
|
||||
WorldMatrix = XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMQuaternionMultiply(XMQuaternionRotationAxis(XMVectorSet(0.f, 1.f, 0.f, 0.f), XMConvertToRadians(90.f)), XMLoadFloat4((_float4*)&pxTranform.q)), XMVectorSetW(XMLoadFloat3((_float3*)&pxTranform.p), 1.f));
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, custumState);
|
||||
_matrix WorldUp = XMMatrixTranslationFromVector(WorldMatrix.r[1] * m_vhalfGeometryInfo.y);
|
||||
_matrix WorldDown = XMMatrixTranslationFromVector(WorldMatrix.r[1] * -m_vhalfGeometryInfo.y);
|
||||
@@ -256,7 +256,7 @@ void CRigidBody_Dynamic::Set_CenterTransform(_vector vStart, _vector vEnd, _bool
|
||||
_float vLength = XMVectorGetX(XMVector3Length(vDir));
|
||||
if (vLength > FLT_EPSILON5) {
|
||||
vDir = XMVector3Normalize(vDir);
|
||||
vRotQ = CMyTools::MakeQuaternionFromTo(XMVectorSet(1.f, 0.f, 0.f, 0.f), vDir);
|
||||
vRotQ = CMyTools::MakeQuaternionFromTo(XMVectorSet(0.f, 1.f, 0.f, 0.f), vDir);
|
||||
}
|
||||
if (true == bTeleport) {
|
||||
Set_Transform(vCenterWorldPos, vRotQ, bTeleport);
|
||||
@@ -383,12 +383,13 @@ HRESULT CRigidBody_Dynamic::Initialize(void* pArg)
|
||||
m_tagData.pBody = this;
|
||||
m_tagData.bAutoOwnerTranslation = pDesc->bAutoOwnerTranslation;
|
||||
m_pRigidBody = m_pGameInstance->Add_DynamicActor(*this, m_pGameInstance->Get_NextLevelID());
|
||||
m_pRigidBody->userData = &m_tagData;
|
||||
m_pRigidBody->setCMassLocalPose(m_PxMassCenter);
|
||||
m_pRigidBody->setRigidDynamicLockFlags(m_eLockFlag);
|
||||
m_pRigidBody->setLinearDamping(m_vDamping.x);
|
||||
m_pRigidBody->setAngularDamping(m_vDamping.y);
|
||||
Move_LocalPos(m_vLocalRotQ, m_vLocalTranslation);
|
||||
if (ACTOR::CAPSULE != m_eActorType) {
|
||||
Move_LocalPos(m_vLocalRotQ, m_vLocalTranslation);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ class CMyTools {
|
||||
}
|
||||
vRotAxis = XMVector3Normalize(vRotAxis);
|
||||
|
||||
_float fRotAngle = acosf(Saturate(fDot));
|
||||
_float fRotAngle = acosf(clamp(fDot, -1.f, 1.f));
|
||||
_vector vRotQ = XMQuaternionRotationAxis(vRotAxis, fRotAngle);
|
||||
return XMQuaternionNormalize(vRotQ);
|
||||
}
|
||||
@@ -337,6 +337,24 @@ class CMyTools {
|
||||
|
||||
return (Alphabet - 'A');
|
||||
}
|
||||
|
||||
inline static PSX::PxTransform MakeJointWorldPoseFromRouteEnd(PSX::PxRigidActor* routeRigidActor, _float3 vCapsuleHalfLengths, bool isHeadEnd)
|
||||
{
|
||||
PSX::PxShape* shapeArray[1] = {};
|
||||
routeRigidActor->getShapes(shapeArray, 1);
|
||||
|
||||
PSX::PxShape* routeShape = shapeArray[0];
|
||||
|
||||
const PSX::PxTransform pxRouteWorldTransfom = PSX::PxShapeExt::getGlobalPose(*routeShape, *routeRigidActor);
|
||||
|
||||
const PSX::PxVec3 capsuleAxisWorld = pxRouteWorldTransfom.q.rotate(PSX::PxVec3(1.f, 0.f, 0.f));
|
||||
|
||||
PSX::PxTransform jointWorldPose;
|
||||
jointWorldPose.q = pxRouteWorldTransfom.q;
|
||||
jointWorldPose.p = pxRouteWorldTransfom.p + (isHeadEnd ? 1.f : -1.f) * capsuleAxisWorld * (vCapsuleHalfLengths.y + vCapsuleHalfLengths.x);
|
||||
|
||||
return jointWorldPose;
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma region FileSystem
|
||||
//static void Folder_Func(/* 재귀적으로 탐색할지 */ _In_ _bool bRecursive,
|
||||
|
||||
@@ -127,6 +127,7 @@ class CPhysX_Manager final : public CBase
|
||||
|
||||
void Update_Kinematic();
|
||||
void Update_Dynamic_ActiveActors();
|
||||
void FixCapsuleShapeAxisToY(PSX::PxShape* pShape);
|
||||
uint32_t ConvertPhysxKindToBit(const PHYSX_USERDATA& physxKind);
|
||||
uint32_t BuildCollisionMaskFromCategoryBit(uint32_t iMyBit);
|
||||
static PSX::PxFilterFlags SimulationFilterShader(PSX::PxFilterObjectAttributes pxAttributes0, PSX::PxFilterData pxFilterData0,
|
||||
|
||||
@@ -39,7 +39,7 @@ class ENGINE_DLL CRigidBody abstract : public CComponent
|
||||
PSX::PxShapeFlags Get_ShapeFlags() const { return m_ePxShapeFlags; }
|
||||
PSX::PxRigidBodyFlags Get_RigidBodyFlags() const { return m_ePxRigidBodyFlags; }
|
||||
|
||||
const PHYSX_USERDATA* Get_UserDataPtr() const { return &m_tagData; };
|
||||
PHYSX_USERDATA* Get_UserDataPtr() { return &m_tagData; };
|
||||
|
||||
protected:
|
||||
ACTOR m_eActorType = ACTOR::END;
|
||||
|
||||
@@ -38,9 +38,11 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody
|
||||
void Set_Name(const _char* szName);
|
||||
_float3 Get_HalfGeometryInfo() const { return m_vhalfGeometryInfo; }
|
||||
void Set_HalfGeometryInfo(_float3 vhalfGeometryInfo);
|
||||
void Move_LocalPos(_matrix newLocalPos);
|
||||
void Move_LocalPos(_fvector vNewRotQ, _gvector vNewTranslation);
|
||||
void Move_LocalPos(_float4& vNewRotQ, _float3& vNewTranslation);
|
||||
|
||||
|
||||
void Move_LocalPos(_matrix newLocalPos);// 캡슐은 이 함수 쓸 거면 말하고 써야함
|
||||
void Move_LocalPos(_fvector vNewRotQ, _gvector vNewTranslation);// 캡슐은 이 함수 쓸 거면 말하고 써야함
|
||||
void Move_LocalPos(_float4& vNewRotQ, _float3& vNewTranslation);// 캡슐은 이 함수 쓸 거면 말하고 써야함
|
||||
_float Get_Density() const { return m_fDensity; }
|
||||
_float Get_Mass();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user