KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::USceneComponent Class Reference

A SceneComponent has a transform and supports attachment, but has no rendering or collision capabilities. Useful as a 'dummy' component in the hierarchy to offset others. More...

#include <SceneComponent.h>

Inheritance diagram for Karma::USceneComponent:
Collaboration diagram for Karma::USceneComponent:

Public Member Functions

 USceneComponent ()
 A constructor.
 
const glm::vec3 & GetRelativeRotation () const
 Gets the literal value of RelativeRotation.
 
const glm::vec3 & GetRelativeLocation () const
 Gets the literal value of RelativeLocation.
 
const glm::vec3 & GetRelativeScale3D () const
 Gets the literal value of RelativeScale3D.
 
void SetWorldLocation (glm::vec3 newLocation)
 
void SetWorldTransform (const FTransform &NewTransform)
 
std::shared_ptr< USceneComponentGetAttachParent () const
 Get the SceneComponent we are attached to.
 
virtual FTransform GetSocketTransform (const std::string &InSocketName, ERelativeTransformSpace TransformSpace=RTS_World) const
 Get world-space socket transform.
 
const FTransformGetComponentTransform () const
 Get the current component-to-world transform for this component.
 
virtual void BeginDestroy () override
 Overridden BeginDestroy for USceneComponent.
 
bool IsUsingAbsoluteLocation () const
 Gets the literal value of bAbsoluteLocation.
 
bool IsUsingAbsoluteRotation () const
 Gets the literal value of bAbsoluteRotation.
 
bool IsUsingAbsoluteScale () const
 Gets the literal value of bAbsoluteScale.
 
void SetRelativeTransform (const FTransform &NewTransform)
 Set the transform of the component relative to its parent.
 
FORCEINLINE const std::string & GetAttachSocketName () const
 Getter for the m_AttachSocektName.
 
- Public Member Functions inherited from Karma::UActorComponent
 UActorComponent ()
 A constructor.
 
virtual void TickComponent (float deltaTime)
 Function called every frame on this ActorComponent. Override this function to implement custom logic to be executed every frame. Only executes if the component is registered, and also PrimaryComponentTick.bCanEverTick must be set to true.
 
virtual void BeginPlay ()
 Begins Play for the component. Called when the owning Actor begins play or when the component is created if the Actor has already begun play. Actor BeginPlay normally happens right after PostInitializeComponents but can be delayed for networked or child actors. Requires component to be registered and initialized.
 
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason)
 Ends gameplay for this component. //Called from AActor::EndPlay only if bHasBegunPlay is true// <- not quite sure about the call.
 
AActorGetOwner () const
 Follow the Outer chain to get the AActor that 'Owns' this component.
 
bool HasBeenCreated () const
 Indicates that OnCreatedComponent has been called, but OnDestroyedComponent has not yet.
 
virtual void OnComponentCreated ()
 Called when a component is created (not loaded). This can happen in the editor or during gameplay.
 
bool IsRegistered () const
 See if this component is currently registered.
 
bool IsActive () const
 Returns whether the component is active or not.
 
virtual void Activate (bool bReset=false)
 Activates the SceneComponent, should be overridden by native child classes.
 
void SetActiveFlag (const bool bNewIsActive)
 Sets the value of bIsActive without causing other side effects to this instance.
 
bool HasBeenInitialized () const
 Indicates that InitializeComponent has been called, but UninitializeComponent has not yet.
 
virtual void InitializeComponent ()
 Initializes the component. Occurs at level startup or actor spawn. This is before BeginPlay (Actor or Component). All Components in the level will be Initialized on load before any Actor/Component gets BeginPlay Requires component to be registered, and bWantsInitializeComponent to be true.
 
bool HasBegunPlay () const
 Indicates that BeginPlay has been called, but EndPlay has not yet.
 
virtual void UninitializeComponent ()
 Handle this component being Uninitialized.
 
virtual void OnComponentDestroyed (bool bDestroyingHierarchy)
 Called when a component is destroyed.
 
- Public Member Functions inherited from Karma::UObject
 UObject ()
 
virtual void FinishDestroy ()
 
virtual const std::string & GetDesc ()
 Return a one line description of an object for viewing in the thumbnail view of the generic browser.
 
virtual class UWorldGetWorld () const
 Returns what UWorld this object is contained within.
 
bool IsValidChecked (const UObject *Test)
 
FORCEINLINE bool Modify (bool bAlwaysMarkDirty=true)
 
bool IsSelected () const
 Test the selection state of a UObject.
 
- Public Member Functions inherited from Karma::UObjectBase
 UObjectBase (UClass *inClass, EObjectFlags inFlags, EInternalObjectFlags inInternalFlags, UObject *inOuter, const std::string &inName)
 
UPackageGetPackage () const
 
UPackageGetExternalPackage () const
 
bool IsUnreachable () const
 
FORCEINLINE void SetInternalIndex (uint32_t StoreIndex)
 
FORCEINLINE uint32_t GetInternalIndex () const
 
void MarkAsGarbage ()
 
void ClearGarbage ()
 
FORCEINLINE const std::string & GetName () const
 
FORCEINLINE void SetObjectName (const std::string &aName)
 
FORCEINLINE UObjectGetOuter () const
 
UObjectGetTypedOuter (UClass *Target) const
 
template<typename T>
T * GetTypedOuter () const
 
bool IsValidLowLevel () const
 
template<typename OtherClassType>
FORCEINLINE bool IsA (OtherClassType SomeBase) const
 
FORCEINLINE UClassGetClass () const
 
FORCEINLINE EObjectFlags GetFlags () const
 
FORCEINLINE void SetFlags (EObjectFlags NewFlags)
 
FORCEINLINE void ClearFlags (EObjectFlags FlagsToClear)
 
FORCEINLINE bool HasAnyFlags (EObjectFlags FlagsToCheck) const
 
FORCEINLINE bool HasAnyInternalFlags (EInternalObjectFlags FlagsToCheck) const
 
FORCEINLINE void SetInternalFlags (EInternalObjectFlags FlagsToSet) const
 
FORCEINLINE void AddToRoot ()
 

Public Attributes

glm::vec3 m_ComponentVelocity
 
std::string m_AttachSocketName
 
std::vector< std::shared_ptr< USceneComponent > > m_AttachChildren
 
- Public Attributes inherited from Karma::UActorComponent
EComponentCreationMethod m_CreationMethod
 
uint8_t m_bAutoActivate: 1
 
uint8_t m_bWantsInitializeComponent: 1
 

Additional Inherited Members

- Static Public Member Functions inherited from Karma::UObject
static const char * StaticConfigName ()
 
- Static Public Member Functions inherited from Karma::UObjectBase
static FORCEINLINE EInternalObjectFlags FixGarbageOrPendingKillInternalObjectFlags (const EInternalObjectFlags InFlags)
 
- Protected Member Functions inherited from Karma::UActorComponent
virtual bool ShouldActivate () const
 
- Protected Member Functions inherited from Karma::UObjectBase
 UObjectBase ()
 Providing a default constructor.
 
FORCEINLINE void SetFlagsTo (EObjectFlags NewFlags)
 
- Protected Attributes inherited from Karma::UActorComponent
uint8_t m_bRegistered: 1
 

Detailed Description

A SceneComponent has a transform and supports attachment, but has no rendering or collision capabilities. Useful as a 'dummy' component in the hierarchy to offset others.

See also
Scene Components

Constructor & Destructor Documentation

◆ USceneComponent()

Karma::USceneComponent::USceneComponent ( )

A constructor.

Since
Karma 1.0.0

Member Function Documentation

◆ BeginDestroy()

void Karma::USceneComponent::BeginDestroy ( )
overridevirtual

Overridden BeginDestroy for USceneComponent.

Since
Karma 1.0.0

Reimplemented from Karma::UActorComponent.

Reimplemented in Karma::UChildActorComponent.

◆ GetAttachParent()

std::shared_ptr< USceneComponent > Karma::USceneComponent::GetAttachParent ( ) const

Get the SceneComponent we are attached to.

Since
Karma 1.0.0

◆ GetAttachSocketName()

FORCEINLINE const std::string & Karma::USceneComponent::GetAttachSocketName ( ) const
inline

Getter for the m_AttachSocektName.

Since
Karma 1.0.0

◆ GetComponentTransform()

const FTransform & Karma::USceneComponent::GetComponentTransform ( ) const
inline

Get the current component-to-world transform for this component.

Since
Karma 1.0.0

◆ GetRelativeLocation()

const glm::vec3 & Karma::USceneComponent::GetRelativeLocation ( ) const
inline

Gets the literal value of RelativeLocation.

Note
This may be an absolute location if this is a root component (not attached to anything) or when IsUsingAbsoluteLocation returns true.

This exists so subclasses don't need to have direct access to the RelativeLocation property so it can be made private later.

Since
Karma 1.0.0

◆ GetRelativeRotation()

const glm::vec3 & Karma::USceneComponent::GetRelativeRotation ( ) const
inline

Gets the literal value of RelativeRotation.

Note
This may be an absolute rotation if this is a root component (not attached to anything) or when GetAbsoluteRotation returns true.

This exists so subclasses don't need to have direct access to the RelativeRotation property so it can be made private later.

Since
Karma 1.0.0

◆ GetRelativeScale3D()

const glm::vec3 & Karma::USceneComponent::GetRelativeScale3D ( ) const
inline

Gets the literal value of RelativeScale3D.

Note
this may be an absolute scale if this is a root component (not attached to anything) or when GetAbsoluteScale3D returns true.

This exists so subclasses don't need to have direct access to the RelativeScale3D property so it can be made private later.

Since
Karma 1.0.0

◆ GetSocketTransform()

FTransform Karma::USceneComponent::GetSocketTransform ( const std::string & InSocketName,
ERelativeTransformSpace TransformSpace = RTS_World ) const
virtual

Get world-space socket transform.

Parameters
InSocketNameName of the socket or the bone to get the transform
Returns
Socket transform in world space if socket if found. Otherwise it will return component's transform in world space.
Since
Karma 1.0.0

◆ IsUsingAbsoluteLocation()

bool Karma::USceneComponent::IsUsingAbsoluteLocation ( ) const
inline

Gets the literal value of bAbsoluteLocation.

This exists so subclasses don't need to have direct access to the bAbsoluteLocation property so it can be made private later.

Since
Karma 1.0.0

◆ IsUsingAbsoluteRotation()

bool Karma::USceneComponent::IsUsingAbsoluteRotation ( ) const
inline

Gets the literal value of bAbsoluteRotation.

This exists so subclasses don't need to have direct access to the bAbsoluteRotation property so it can be made private later.

Since
Karma 1.0.0

◆ IsUsingAbsoluteScale()

bool Karma::USceneComponent::IsUsingAbsoluteScale ( ) const
inline

Gets the literal value of bAbsoluteScale.

This exists so subclasses don't need to have direct access to the bReplicates property so it can be made private later.

Since
Karma 1.0.0

◆ SetRelativeTransform()

void Karma::USceneComponent::SetRelativeTransform ( const FTransform & NewTransform)

Set the transform of the component relative to its parent.

Parameters
NewTransformNew transform of the component relative to its parent.

To be activated once physics is enabled

Parameters
SweepHitResultHit result from any impact if sweep is true.
bSweepWhether we sweep to the destination (currently not supported for rotation).
bTeleportWhether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts).
Since
Karma 1.0.0

◆ SetWorldLocation()

void Karma::USceneComponent::SetWorldLocation ( glm::vec3 newLocation)

Put this component at the specified location in world space. Updates relative location to achieve the final world location.

Parameters
NewLocationNew location in world space for the component.

These params shall be incorporated later in dev cycle.

Parameters
SweepHitResultHit result from any impact if sweep is true.
bSweepWhether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
bTeleportWhether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
Since
Karma 1.0.0

◆ SetWorldTransform()

void Karma::USceneComponent::SetWorldTransform ( const FTransform & NewTransform)

Set the transform of the component in world space.

Parameters
NewTransformNew transform in world space for the component.

Rest are physics related. To be implemented in future.

Parameters
SweepHitResultHit result from any impact if sweep is true.
bSweepWhether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
bTeleportWhether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
Since
Karma 1.0.0

Member Data Documentation

◆ m_AttachChildren

std::vector<std::shared_ptr<USceneComponent> > Karma::USceneComponent::m_AttachChildren

List of child SceneComponents that are attached to us.

◆ m_AttachSocketName

std::string Karma::USceneComponent::m_AttachSocketName

What we are currently attached to. If valid, RelativeLocation etc. are used relative to this object Optional socket name on AttachParent that we are attached to.

◆ m_ComponentVelocity

glm::vec3 Karma::USceneComponent::m_ComponentVelocity

Velocity of the component.

See also
GetComponentVelocity()

The documentation for this class was generated from the following files: