KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
SceneComponent.h
Go to the documentation of this file.
1
10#pragma once
11
12#include "krpch.h"
13
14#include "ActorComponent.h"
15#include "glm/glm.hpp"
16
17#include "Ganit/Transform.h"
18
19namespace Karma
20{
21 class FTransform;
22 class USceneComponent;
23
36
44 {
46
47 public:
54
56 //FTransform GetRelativeTransform() const;
57
58 private:
60 glm::vec3 m_RelativeLocation;
61
63 glm::vec3 m_RelativeRotation;
64
69 glm::vec3 m_RelativeScale3D;
70
72 std::shared_ptr<USceneComponent> m_AttachParent;
73
75 FTransform m_ComponentToWorld;
76
78 uint8_t m_bAbsoluteLocation : 1;
79
81 uint8_t m_bAbsoluteRotation : 1;
82
84 uint8_t m_bAbsoluteScale : 1;
85
86 public:
92
93 public:
95 //std::shared_ptr<USceneComponent> m_AttachParent;
96
98 std::string m_AttachSocketName;
99
101 std::vector<std::shared_ptr<USceneComponent>> m_AttachChildren;
102
113 const glm::vec3& GetRelativeRotation() const
114 {
115 return m_RelativeRotation;
116 }
117
128 const glm::vec3& GetRelativeLocation() const
129 {
130 return m_RelativeLocation;
131 }
132
143 const glm::vec3& GetRelativeScale3D() const
144 {
145 return m_RelativeScale3D;
146 }
147
148 public:
164 void SetWorldLocation(glm::vec3 newLocation);
165
180 void SetWorldTransform(const FTransform& NewTransform/*, bool bSweep = false, FHitResult* OutSweepHitResult = nullptr, ETeleportType Teleport = ETeleportType::None*/);
181
187 std::shared_ptr<USceneComponent> GetAttachParent() const;
188
197 virtual FTransform GetSocketTransform(const std::string& InSocketName, ERelativeTransformSpace TransformSpace = RTS_World) const;
198
204 inline const FTransform& GetComponentTransform() const
205 {
206 return m_ComponentToWorld;
207 }
208
214 virtual void BeginDestroy() override;
215
225 {
226 return m_bAbsoluteLocation;
227 }
228
238 {
239 return m_bAbsoluteRotation;
240 }
241
251 {
252 return m_bAbsoluteScale;
253 }
254
269 void SetRelativeTransform(const FTransform& NewTransform/*, bool bSweep = false, FHitResult* OutSweepHitResult = nullptr, ETeleportType Teleport = ETeleportType::None*/);
270
276 FORCEINLINE const std::string& GetAttachSocketName() const
277 {
278 return m_AttachSocketName;
279 }
280 };
281}
This file contains the class UActorComponent.
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
#define FORCEINLINE
Typical inlining macro for clarity.
Definition Core.h:157
#define DECLARE_KARMA_CLASS(TClass, TSuperClass)
Karma's gamecode object class declaration.
Definition GFrameworkMacros.h:44
ERelativeTransformSpace
The space for the transform.
Definition SceneComponent.h:26
@ RTS_World
Definition SceneComponent.h:28
@ RTS_Component
Definition SceneComponent.h:32
@ RTS_Actor
Definition SceneComponent.h:30
@ RTS_ParentBoneSpace
Definition SceneComponent.h:34
This file contains the math specific for transforms.
Definition Transform.h:116
UActorComponent()
A constructor.
Definition ActorComponent.cpp:8
A SceneComponent has a transform and supports attachment, but has no rendering or collision capabilit...
Definition SceneComponent.h:44
bool IsUsingAbsoluteScale() const
Gets the literal value of bAbsoluteScale.
Definition SceneComponent.h:250
bool IsUsingAbsoluteLocation() const
Gets the literal value of bAbsoluteLocation.
Definition SceneComponent.h:224
const glm::vec3 & GetRelativeRotation() const
Gets the literal value of RelativeRotation.
Definition SceneComponent.h:113
glm::vec3 m_ComponentVelocity
Definition SceneComponent.h:91
const glm::vec3 & GetRelativeLocation() const
Gets the literal value of RelativeLocation.
Definition SceneComponent.h:128
FORCEINLINE const std::string & GetAttachSocketName() const
Getter for the m_AttachSocektName.
Definition SceneComponent.h:276
const glm::vec3 & GetRelativeScale3D() const
Gets the literal value of RelativeScale3D.
Definition SceneComponent.h:143
bool IsUsingAbsoluteRotation() const
Gets the literal value of bAbsoluteRotation.
Definition SceneComponent.h:237
const FTransform & GetComponentTransform() const
Get the current component-to-world transform for this component.
Definition SceneComponent.h:204
USceneComponent()
A constructor.
Definition SceneComponent.cpp:8
std::vector< std::shared_ptr< USceneComponent > > m_AttachChildren
Definition SceneComponent.h:101
std::string m_AttachSocketName
Definition SceneComponent.h:98