[add] 키네마틱무빙, 텔레포트 무빙 분리
This commit is contained in:
@@ -338,7 +338,7 @@ void CMapElement_Interactable::ActivateAt(_fvector vPos)
|
||||
m_pTransformCom->Set_State(STATE::POSITION, vPos);
|
||||
m_pInfoInstance->Regist_ActiveInteractive(this);
|
||||
m_pRigidBody->Set_Kinematic(false);
|
||||
m_pRigidBody->Set_Position(vPos);
|
||||
m_pRigidBody->Set_Position(vPos, true);
|
||||
}
|
||||
|
||||
ON_COLLISION_INFO CMapElement_Interactable::CollisionCheck(_fvector StartPos, _fvector EndPos, _float fRadius)
|
||||
|
||||
@@ -19,7 +19,7 @@ void CPlayerRobe::Update(_float fTimeDelta)
|
||||
{
|
||||
_matrix OwnerMatrix = XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr());
|
||||
m_pTransformCom->Set_WorldMatrix(OwnerMatrix);
|
||||
m_pRobeMainAnchor->Set_Transform(XMLoadFloat4x4(m_pSocketMatrix) * OwnerMatrix);
|
||||
m_pRobeMainAnchor->Move_Kinematic(XMLoadFloat4x4(m_pSocketMatrix) * OwnerMatrix, true);
|
||||
Update_LegsPosition();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ HRESULT CPlayerRobe::Helper_RouteJointGenerater(CRigidBody_Dynamic::RIGIDBODY_DY
|
||||
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]);
|
||||
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());
|
||||
@@ -66,7 +66,7 @@ HRESULT CPlayerRobe::Update_LegsPosition()
|
||||
|
||||
_vector vFootPos = XMVector4Transform(XMLoadFloat4((_float4*)&m_pLeftFootLocalMatrix->m[3][0]), WorldMatrix);
|
||||
_vector vLegPos = XMVector4Transform(XMLoadFloat4((_float4*)&m_pLeftLegLocalMatrix->m[3][0]), WorldMatrix);
|
||||
m_pLeftLeg->Set_CenterTransform(vFootPos, vLegPos);
|
||||
m_pLeftLeg->Set_CenterTransform(vFootPos, vLegPos, false);
|
||||
|
||||
#ifdef _DEBUG
|
||||
{
|
||||
@@ -84,7 +84,7 @@ HRESULT CPlayerRobe::Update_LegsPosition()
|
||||
|
||||
vFootPos = XMVector4Transform(XMLoadFloat4((_float4*)&m_pRightFootLocalMatrix->m[3][0]), WorldMatrix);
|
||||
vLegPos = XMVector4Transform(XMLoadFloat4((_float4*)&m_pRightLegLocalMatrix->m[3][0]), WorldMatrix);
|
||||
m_pRightLeg->Set_CenterTransform(vFootPos, vLegPos);
|
||||
m_pRightLeg->Set_CenterTransform(vFootPos, vLegPos, false);
|
||||
|
||||
#ifdef _DEBUG
|
||||
{
|
||||
@@ -244,7 +244,7 @@ HRESULT CPlayerRobe::Ready_Components()
|
||||
return E_FAIL;
|
||||
}
|
||||
m_pRobeMainAnchor->Set_Kinematic(true);
|
||||
m_pRobeMainAnchor->Set_Transform(socketWorld);
|
||||
m_pRobeMainAnchor->Set_Transform(socketWorld, true);
|
||||
#ifdef _DEBUG
|
||||
m_pRobeMainAnchor->Set_Name("MainAnchor");
|
||||
#endif // _DEBUG
|
||||
@@ -257,8 +257,8 @@ HRESULT CPlayerRobe::Ready_Components()
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_JOINT_ANCHOR"), (CComponent**)&m_pRobeJointAnchor[i], &Desc))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pRobeJointAnchor[i]->Set_Transform(xmAnchorMatricesWorld[i]);
|
||||
|
||||
m_pRobeJointAnchor[i]->Set_Transform(xmAnchorMatricesWorld[i], true);
|
||||
#ifdef _DEBUG
|
||||
m_pRobeJointAnchor[i]->Set_Name(PLAYER_JOINT_BONE_NAMES[i]);
|
||||
#endif // _DEBUG
|
||||
@@ -280,7 +280,7 @@ HRESULT CPlayerRobe::Ready_Components()
|
||||
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(socketWorld.r[3], xmAnchorMatricesWorld[Desc_Route.iEndBoneIndex].r[3]);
|
||||
m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_CenterTransform(socketWorld.r[3], xmAnchorMatricesWorld[Desc_Route.iEndBoneIndex].r[3], true);
|
||||
#ifdef _DEBUG
|
||||
m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_Name("Origin_Linked_Routes");
|
||||
#endif // _DEBUG
|
||||
@@ -298,7 +298,7 @@ HRESULT CPlayerRobe::Ready_Components()
|
||||
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(socketWorld.r[3], xmAnchorMatricesWorld[Desc_Route.iEndBoneIndex].r[3]);
|
||||
m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_CenterTransform(socketWorld.r[3], xmAnchorMatricesWorld[Desc_Route.iEndBoneIndex].r[3], true);
|
||||
#ifdef _DEBUG
|
||||
m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_Name("Origin_Linked_Routes");
|
||||
#endif // _DEBUG
|
||||
@@ -316,7 +316,7 @@ HRESULT CPlayerRobe::Ready_Components()
|
||||
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(socketWorld.r[3], xmAnchorMatricesWorld[Desc_Route.iEndBoneIndex].r[3]);
|
||||
m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_CenterTransform(socketWorld.r[3], xmAnchorMatricesWorld[Desc_Route.iEndBoneIndex].r[3], true);
|
||||
#ifdef _DEBUG
|
||||
m_pRobeJointRoute[Desc_Route.iTargetRouteIndex]->Set_Name("Origin_Linked_Routes");
|
||||
#endif // _DEBUG
|
||||
@@ -487,9 +487,13 @@ void CPlayerRobe::Free()
|
||||
#endif // _DEBUG
|
||||
SAFE_RELEASE(m_pRightLeg);
|
||||
SAFE_RELEASE(m_pLeftLeg);
|
||||
SAFE_RELEASE(m_pRobeMainAnchor);
|
||||
for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_ROUTE_ORDER::END); ++i) {
|
||||
SAFE_RELEASE(m_pRobeJointRoute[i]);
|
||||
}
|
||||
for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) {
|
||||
SAFE_RELEASE(m_pRobeJointAnchor[i]);
|
||||
}
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
|
||||
@@ -156,24 +156,29 @@ void CRigidBody_Dynamic::Set_Kinematic(_bool bKinematic)
|
||||
m_pRigidBody->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, bKinematic);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Move_Kinematic(_fmatrix xmTransform)
|
||||
void CRigidBody_Dynamic::Move_Kinematic(_fmatrix xmTransform, _bool bTeleport)
|
||||
{
|
||||
_vector vScale, vPos, vRotQ;
|
||||
XMMatrixDecompose(&vScale, &vRotQ, &vPos, xmTransform);
|
||||
Move_Kinematic(vPos, vRotQ);
|
||||
Move_Kinematic(vPos, vRotQ, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Move_Kinematic(_fvector vPos, _gvector vRotq)
|
||||
void CRigidBody_Dynamic::Move_Kinematic(_fvector vPos, _gvector vRotq, _bool bTeleport)
|
||||
{
|
||||
PSX::PxTransform pxTransform = {};
|
||||
XMStoreFloat3((_float3*)&pxTransform.p, vPos);
|
||||
XMStoreFloat4((_float4*)&pxTransform.q, vRotq);
|
||||
Move_Kinematic(pxTransform);
|
||||
Move_Kinematic(pxTransform, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Move_Kinematic(PSX::PxTransform& pxDestination)
|
||||
void CRigidBody_Dynamic::Move_Kinematic(PSX::PxTransform& pxDestination, _bool bTeleport)
|
||||
{
|
||||
m_pRigidBody->setKinematicTarget(pxDestination);
|
||||
if (true == bTeleport) {
|
||||
Set_Transform(pxDestination, bTeleport);
|
||||
}
|
||||
else {
|
||||
m_pRigidBody->setKinematicTarget(pxDestination);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CRigidBody_Dynamic::ConvertToCCT(CCharacter_Controller& CCTOriginal)
|
||||
@@ -203,33 +208,33 @@ _vector CRigidBody_Dynamic::Get_Position()
|
||||
return vPos;
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Position(_vector vPos)
|
||||
void CRigidBody_Dynamic::Set_Position(_vector vPos, _bool bTeleport)
|
||||
{
|
||||
PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose();
|
||||
pxTransform.p.x = vPos.m128_f32[0];
|
||||
pxTransform.p.y = vPos.m128_f32[1];
|
||||
pxTransform.p.z = vPos.m128_f32[2];
|
||||
Set_Transform(pxTransform);
|
||||
Set_Transform(pxTransform, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Rotation(_vector vRotQ)
|
||||
void CRigidBody_Dynamic::Set_Rotation(_vector vRotQ, _bool bTeleport)
|
||||
{
|
||||
PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose();
|
||||
pxTransform.q.x = vRotQ.m128_f32[0];
|
||||
pxTransform.q.y = vRotQ.m128_f32[1];
|
||||
pxTransform.q.z = vRotQ.m128_f32[2];
|
||||
pxTransform.q.w = vRotQ.m128_f32[3];
|
||||
Set_Transform(pxTransform);
|
||||
Set_Transform(pxTransform, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Transform(_matrix WorldMatrix)
|
||||
void CRigidBody_Dynamic::Set_Transform(_matrix WorldMatrix, _bool bTeleport)
|
||||
{
|
||||
_vector vScale, vPos, vRotQ;
|
||||
XMMatrixDecompose(&vScale, &vRotQ, &vPos, WorldMatrix);
|
||||
Set_Transform(vPos, vRotQ);
|
||||
Set_Transform(vPos, vRotQ, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Transform(_vector vPos, _vector vRotQ)
|
||||
void CRigidBody_Dynamic::Set_Transform(_vector vPos, _vector vRotQ, _bool bTeleport)
|
||||
{
|
||||
PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose();
|
||||
pxTransform.p.x = vPos.m128_f32[0];
|
||||
@@ -240,10 +245,10 @@ void CRigidBody_Dynamic::Set_Transform(_vector vPos, _vector vRotQ)
|
||||
pxTransform.q.y = vRotQ.m128_f32[1];
|
||||
pxTransform.q.z = vRotQ.m128_f32[2];
|
||||
pxTransform.q.w = vRotQ.m128_f32[3];
|
||||
Set_Transform(pxTransform);
|
||||
Set_Transform(pxTransform, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_CenterTransform(_vector vStart, _vector vEnd)
|
||||
void CRigidBody_Dynamic::Set_CenterTransform(_vector vStart, _vector vEnd, _bool bTeleport)
|
||||
{
|
||||
_vector vCenterWorldPos = (vStart + vEnd) * 0.5f;
|
||||
_vector vRotQ = XMQuaternionIdentity();
|
||||
@@ -253,17 +258,29 @@ void CRigidBody_Dynamic::Set_CenterTransform(_vector vStart, _vector vEnd)
|
||||
vDir = XMVector3Normalize(vDir);
|
||||
vRotQ = CMyTools::MakeQuaternionFromTo(XMVectorSet(1.f, 0.f, 0.f, 0.f), vDir);
|
||||
}
|
||||
if (m_pRigidBody->getRigidBodyFlags() & PSX::PxRigidBodyFlag::eKINEMATIC) {
|
||||
Move_Kinematic(vCenterWorldPos, vRotQ);
|
||||
if (true == bTeleport) {
|
||||
Set_Transform(vCenterWorldPos, vRotQ, bTeleport);
|
||||
}
|
||||
else {
|
||||
Set_Transform(vCenterWorldPos, vRotQ);
|
||||
if (m_pRigidBody->getRigidBodyFlags() & PSX::PxRigidBodyFlag::eKINEMATIC) {
|
||||
Move_Kinematic(vCenterWorldPos, vRotQ);
|
||||
}
|
||||
else {
|
||||
Set_Transform(vCenterWorldPos, vRotQ, bTeleport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Transform(PSX::PxTransform pxTransform)
|
||||
void CRigidBody_Dynamic::Set_Transform(PSX::PxTransform pxTransform, _bool bTeleport)
|
||||
{
|
||||
m_pRigidBody->setGlobalPose(pxTransform);
|
||||
m_pRigidBody->setGlobalPose(pxTransform, true);
|
||||
|
||||
if (true == bTeleport) {
|
||||
m_pRigidBody->setLinearVelocity(PSX::PxVec3(0.f, 0.f, 0.f));
|
||||
m_pRigidBody->setAngularVelocity(PSX::PxVec3(0.f, 0.f, 0.f));
|
||||
m_pRigidBody->clearForce();
|
||||
m_pRigidBody->clearTorque();
|
||||
}
|
||||
}
|
||||
|
||||
_float3 CRigidBody_Dynamic::Get_FootPosition()
|
||||
@@ -378,6 +395,23 @@ HRESULT CRigidBody_Dynamic::Initialize(void* pArg)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//void CRigidBody_Dynamic::Move(PSX::PxTransform& pxTransform, _bool bTeleport)
|
||||
//{
|
||||
// if (m_pRigidBody->getRigidBodyFlags().isSet(PSX::PxRigidBodyFlag::eKINEMATIC)) {
|
||||
// m_pRigidBody->setKinematicTarget(pxTransform);
|
||||
// }
|
||||
// else {
|
||||
// m_pRigidBody->setGlobalPose(pxTransform, true);
|
||||
//
|
||||
// if (true == bTeleport) {
|
||||
// m_pRigidBody->setLinearVelocity(PSX::PxVec3(0.f, 0.f, 0.f));
|
||||
// m_pRigidBody->setAngularVelocity(PSX::PxVec3(0.f, 0.f, 0.f));
|
||||
// m_pRigidBody->clearForce();
|
||||
// m_pRigidBody->clearTorque();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT CRigidBody_Dynamic::Add_DebugShape()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -47,9 +47,9 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody
|
||||
virtual void Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 속도 + 방향
|
||||
virtual void Add_Torque(_fvector vDirection, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 방향 ( 회전축은 MassCenter )
|
||||
void Set_Kinematic(_bool bKinematic);
|
||||
void Move_Kinematic(_fmatrix xmTransform);
|
||||
void Move_Kinematic(_fvector vPos, _gvector vRotq);
|
||||
void Move_Kinematic(PSX::PxTransform& pxDestination);
|
||||
void Move_Kinematic(_fmatrix xmTransform, _bool bTeleport = true);
|
||||
void Move_Kinematic(_fvector vPos, _gvector vRotq, _bool bTeleport = true);
|
||||
void Move_Kinematic(PSX::PxTransform& pxDestination, _bool bTeleport = true);
|
||||
|
||||
HRESULT ConvertToCCT(class CCharacter_Controller& CCTOriginal);
|
||||
void Detach_Actor(_uint iLevel);
|
||||
@@ -57,14 +57,16 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody
|
||||
void SetActive(_bool bCondition) { m_bActive = bCondition; }
|
||||
|
||||
_vector Get_Position();
|
||||
void Set_Position(_vector vPos);
|
||||
void Set_Rotation(_vector vRotQ);
|
||||
void Set_Position(_vector vPos, _bool bTeleport);
|
||||
void Set_Rotation(_vector vRotQ, _bool bTeleport);
|
||||
void Set_AutoOwnerTranlation(_bool bAutoOwnerTranslation) { m_tagData.bAutoOwnerTranslation = bAutoOwnerTranslation; };
|
||||
_bool Get_AutoOwnerTranlation() { return m_tagData.bAutoOwnerTranslation; };
|
||||
void Set_Transform(_matrix WorldMatrix);
|
||||
void Set_Transform(_vector vPos, _vector vRotQ);
|
||||
void Set_Transform(PSX::PxTransform pxTransform);
|
||||
void Set_CenterTransform(_vector vStart, _vector vEnd);
|
||||
|
||||
void Set_Transform(_matrix WorldMatrix, _bool bTeleport);
|
||||
void Set_Transform(_vector vPos, _vector vRotQ, _bool bTeleport);
|
||||
void Set_Transform(PSX::PxTransform pxTransform, _bool bTeleport);
|
||||
|
||||
void Set_CenterTransform(_vector vStart, _vector vEnd, _bool bTeleport);
|
||||
_float3 Get_FootPosition();
|
||||
_float3 Get_HeadPosition();
|
||||
PSX::PxTransform Get_GlobalPosition();
|
||||
@@ -88,6 +90,7 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody
|
||||
private:
|
||||
HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPE_DYNAMIC_DESC& Desc);
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
// void Move(PSX::PxTransform& pxTransform, _bool bTeleport);
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT Add_DebugShape();
|
||||
|
||||
Reference in New Issue
Block a user