Karma Engine
Loading...
Searching...
No Matches
SceneComponent.h
1#pragma once
2
3#include "krpch.h"
4
5#include "ActorComponent.h"
6#include "glm/glm.hpp"
7
8#include "Ganit/Transform.h"
9
10namespace Karma
11{
12 class FTransform;
13 class USceneComponent;
14
16 enum ERelativeTransformSpace
17 {
19 RTS_World,
21 RTS_Actor,
23 RTS_Component,
25 RTS_ParentBoneSpace,
26 };
27
33 class KARMA_API USceneComponent : public UActorComponent
34 {
35 DECLARE_KARMA_CLASS(USceneComponent, UActorComponent)
36
37 public:
39
41 //FTransform GetRelativeTransform() const;
42
43 private:
45 glm::vec3 m_RelativeLocation;
46
48 glm::vec3 m_RelativeRotation;
49
54 glm::vec3 m_RelativeScale3D;
55
57 std::shared_ptr<USceneComponent> m_AttachParent;
58
60 FTransform m_ComponentToWorld;
61
63 uint8_t m_bAbsoluteLocation : 1;
64
66 uint8_t m_bAbsoluteRotation : 1;
67
69 uint8_t m_bAbsoluteScale : 1;
70
71 public:
77
78 public:
80 //std::shared_ptr<USceneComponent> m_AttachParent;
81
83 std::string m_AttachSocketName;
84
86 std::vector<std::shared_ptr<USceneComponent>> m_AttachChildren;
87
96 const glm::vec3& GetRelativeRotation() const
97 {
98 return m_RelativeRotation;
99 }
100
109 const glm::vec3& GetRelativeLocation() const
110 {
111 return m_RelativeLocation;
112 }
113
122 const glm::vec3& GetRelativeScale3D() const
123 {
124 return m_RelativeScale3D;
125 }
126
127 public:
141 void SetWorldLocation(glm::vec3 newLocation);
142
156 void SetWorldTransform(const FTransform& NewTransform/*, bool bSweep = false, FHitResult* OutSweepHitResult = nullptr, ETeleportType Teleport = ETeleportType::None*/);
157
159 std::shared_ptr<USceneComponent> GetAttachParent() const;
160
166 virtual FTransform GetSocketTransform(const std::string& InSocketName, ERelativeTransformSpace TransformSpace = RTS_World) const;
167
169 inline const FTransform& GetComponentTransform() const
170 {
171 return m_ComponentToWorld;
172 }
173
174 virtual void BeginDestroy() override;
175
183 {
184 return m_bAbsoluteLocation;
185 }
186
194 {
195 return m_bAbsoluteRotation;
196 }
197
205 {
206 return m_bAbsoluteScale;
207 }
208
220 void SetRelativeTransform(const FTransform& NewTransform/*, bool bSweep = false, FHitResult* OutSweepHitResult = nullptr, ETeleportType Teleport = ETeleportType::None*/);
221
222 FORCEINLINE const std::string& GetAttachSocketName() const
223 {
224 return m_AttachSocketName;
225 }
226 };
227}
Definition Transform.h:107
Definition ActorComponent.h:35
Definition SceneComponent.h:34
bool IsUsingAbsoluteScale() const
Definition SceneComponent.h:204
bool IsUsingAbsoluteLocation() const
Definition SceneComponent.h:182
const glm::vec3 & GetRelativeRotation() const
Definition SceneComponent.h:96
glm::vec3 m_ComponentVelocity
Definition SceneComponent.h:76
const glm::vec3 & GetRelativeLocation() const
Definition SceneComponent.h:109
const glm::vec3 & GetRelativeScale3D() const
Definition SceneComponent.h:122
bool IsUsingAbsoluteRotation() const
Definition SceneComponent.h:193
const FTransform & GetComponentTransform() const
Definition SceneComponent.h:169
std::vector< std::shared_ptr< USceneComponent > > m_AttachChildren
Definition SceneComponent.h:86
std::string m_AttachSocketName
Definition SceneComponent.h:83