1 // Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
4 #include "BaseEnv/Components/BaseEnv_EntityTransformComponentBase.h"
6 namespace SchematycBaseEnv
8 const int g_emptySlot
= -1;
10 const Schematyc2::SGUID
g_tranformAttachmentGUID("64020f3e-1cd3-41e9-8bbb-92563378d111");
12 CEntityTransformComponentBase::CEntityTransformComponentBase()
17 bool CEntityTransformComponentBase::Init(const Schematyc2::SComponentParams
& params
)
19 if(!CEntityComponentBase::Init(params
))
24 m_pParent
= static_cast<CEntityTransformComponentBase
*>(params
.pParent
);
28 void CEntityTransformComponentBase::Shutdown()
33 void CEntityTransformComponentBase::SetSlot(int slot
, const STransform
& transform
)
39 CEntityComponentBase::GetEntity().SetParentSlot(m_pParent
->GetSlot(), slot
);
42 Matrix34 slotTM
= Matrix34::CreateRotationXYZ(transform
.rot
);
44 matScale
.SetScale(transform
.scale
);
46 slotTM
= slotTM
* matScale
;
47 slotTM
.SetTranslation(transform
.pos
);
49 CEntityComponentBase::GetEntity().SetSlotLocalTM(slot
, slotTM
);
52 int CEntityTransformComponentBase::GetSlot() const
57 bool CEntityTransformComponentBase::SlotIsValid() const
59 return m_slot
!= g_emptySlot
;
62 void CEntityTransformComponentBase::FreeSlot()
64 if(m_slot
!= g_emptySlot
)
66 CEntityComponentBase::GetEntity().FreeSlot(m_slot
);
71 Matrix34
CEntityTransformComponentBase::GetWorldTM() const
73 return CEntityComponentBase::GetEntity().GetSlotWorldTM(m_slot
);