RapyutaSimulationPlugins
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
URRStaticMeshComponent Class Reference

Component of ARRMeshActor. UStaticMeshComponent with utils. More...

#include <RRStaticMeshComponent.h>

Inheritance diagram for URRStaticMeshComponent:
Inheritance graph
[legend]
Collaboration diagram for URRStaticMeshComponent:
Collaboration graph
[legend]

Public Member Functions

 URRStaticMeshComponent ()
 
void Initialize (bool bInIsStationary, bool bInIsPhysicsEnabled)
 Set Mobility and Physics Enabled. More...
 
bool InitializeMesh (const FString &InMeshFileName)
 Initialize mesh. initialization is different based on mesh type, ERRShapeType, which can be get from URRGameSingleton::GetShapeTypeFromMeshName. More...
 
UStaticMesh * CreateMeshBody (const FRRMeshData &InMeshData)
 Create a Mesh Body object. More...
 
void SetMesh (UStaticMesh *InStaticMesh)
 Set Static mesh from UstaticMesh. More...
 
void SetMeshSize (const FVector &InSize)
 
UStaticMesh * CreateMesh (const FRRMeshData &InMeshData, bool bInAsVisualMesh)
 Create a static mesh. More...
 
void GenerateCustomSimpleCollision (const FRRMeshData &InMeshData, UBodySetup *OutBodySetup)
 Generate custom simple collision, only if not bUseDefaultSimpleCollision. More...
 
FVector GetSize () const
 Get the Size of bounding box of the mesh. More...
 
FVector GetExtent () const
 Get the extent of bounding box of the mesh. More...
 
FVector GetScaledExtent () const
 
void LockSelf ()
 This function is used proprietarily for Generic Link/Joint (Non-Articulation) structure. More...
 
void HideSelf (bool bInHidden)
 
void SetCollisionModeAvailable (bool bInCollisionEnabled, bool bInHitEventEnabled=false)
 Set the Collision Mode with some preset parameters. More...
 
void EnableOverlapping (bool bOverlapEventEnabled)
 

Public Attributes

FOnMeshCreationDone OnMeshCreationDone
 
int8 SceneInstanceId = 0
 
URRActorCommonActorCommon = nullptr
 
FString MeshUniqueName
 
bool bMeshRuntimeCreated = false
 
ERRShapeType ShapeType = ERRShapeType::NONE
 
FTransform OriginRelativeTransform
 
bool bIsStationary = false
 
bool bUseDefaultSimpleCollision = true
 Whether static mesh is built with simple collision, also configurable in ARRMeshActor::Initialize() More...
 
bool bUseComplexCollision = false
 Whether a complex collision mesh is built alongside the visual static mesh. More...
 

Static Public Attributes

static constexpr int8 CUSTOM_DEPTH_STENCIL_VOID = 0
 

Protected Member Functions

virtual void BeginPlay () override
 It is considered that a mesh component should only be physically activated if its Owning Actor is Physically Enabled,. More...
 

Private Member Functions

void CreateMeshSection (const TArray< FRRMeshNodeData > &InMeshSectionData, FMeshDescriptionBuilder &OutMeshDescBuilder)
 

Private Attributes

FTimerHandle StaticMeshTimerHandle
 

Friends

class URRObjectUtils
 

Detailed Description

Component of ARRMeshActor. UStaticMeshComponent with utils.

Todo:
documentation.

UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))

Constructor & Destructor Documentation

◆ URRStaticMeshComponent()

URRStaticMeshComponent::URRStaticMeshComponent ( )

Member Function Documentation

◆ BeginPlay()

virtual void URRStaticMeshComponent::BeginPlay ( )
overrideprotectedvirtual

It is considered that a mesh component should only be physically activated if its Owning Actor is Physically Enabled,.

thus not auto activating physics here! Rather, it is left to the Owning actor to do it!

◆ CreateMesh()

UStaticMesh* URRStaticMeshComponent::CreateMesh ( const FRRMeshData InMeshData,
bool  bInAsVisualMesh 
)

Create a static mesh.

Parameters
InMeshData
bInAsVisualMeshWhether it is created as a visual or collision mesh
Returns
UStaticMesh

◆ CreateMeshBody()

UStaticMesh* URRStaticMeshComponent::CreateMeshBody ( const FRRMeshData InMeshData)

Create a Mesh Body object.

Note
This function could be invoked from an async task running in GameThread
Parameters
InMeshData
Returns
UStaticMesh*

◆ CreateMeshSection()

void URRStaticMeshComponent::CreateMeshSection ( const TArray< FRRMeshNodeData > &  InMeshSectionData,
FMeshDescriptionBuilder &  OutMeshDescBuilder 
)
private

◆ EnableOverlapping()

void URRStaticMeshComponent::EnableOverlapping ( bool  bOverlapEventEnabled)

◆ GenerateCustomSimpleCollision()

void URRStaticMeshComponent::GenerateCustomSimpleCollision ( const FRRMeshData InMeshData,
UBodySetup *  OutBodySetup 
)

Generate custom simple collision, only if not bUseDefaultSimpleCollision.

◆ GetExtent()

FVector URRStaticMeshComponent::GetExtent ( ) const

Get the extent of bounding box of the mesh.

Returns
FVector

UFUNCTION()

◆ GetScaledExtent()

FVector URRStaticMeshComponent::GetScaledExtent ( ) const

◆ GetSize()

FVector URRStaticMeshComponent::GetSize ( ) const

Get the Size of bounding box of the mesh.

Returns
FVector

UFUNCTION()

◆ HideSelf()

void URRStaticMeshComponent::HideSelf ( bool  bInHidden)

◆ Initialize()

void URRStaticMeshComponent::Initialize ( bool  bInIsStationary,
bool  bInIsPhysicsEnabled 
)

Set Mobility and Physics Enabled.

Note
Upon creation, DO NOT enable physics here yet, which will makes mesh comp detached from its parent.

Physics should only be enabled after children mesh comps have also been created, so they will be welded.

Refer to [FBodyInstance::SetInstanceSimulatePhysics()]

Parameters
bInIsStationary
bInIsPhysicsEnabled

◆ InitializeMesh()

bool URRStaticMeshComponent::InitializeMesh ( const FString &  InMeshFileName)

Initialize mesh. initialization is different based on mesh type, ERRShapeType, which can be get from URRGameSingleton::GetShapeTypeFromMeshName.

Uses URRThreadUtils::DoAsyncTaskInThread and URRThreadUtils::DoTaskInGameThread to load Mesh

If ShapeType is not ERRShapeType::MESH i.e. primitive-shape, initialization is done by SetMesh

Parameters
InMeshFileName
Returns
true
false

◆ LockSelf()

void URRStaticMeshComponent::LockSelf ( )

This function is used proprietarily for Generic Link/Joint (Non-Articulation) structure.

UFUNCTION()

◆ SetCollisionModeAvailable()

void URRStaticMeshComponent::SetCollisionModeAvailable ( bool  bInCollisionEnabled,
bool  bInHitEventEnabled = false 
)

Set the Collision Mode with some preset parameters.

Todo:
is preset parameter cover all use case?
Parameters
bInCollisionEnabled
bInHitEventEnabled

UFUNCTION()

◆ SetMesh()

void URRStaticMeshComponent::SetMesh ( UStaticMesh *  InStaticMesh)

Set Static mesh from UstaticMesh.

See also
SetStaticMesh
Parameters
InStaticMesh

◆ SetMeshSize()

void URRStaticMeshComponent::SetMeshSize ( const FVector &  InSize)
inline

Friends And Related Function Documentation

◆ URRObjectUtils

friend class URRObjectUtils
friend

Member Data Documentation

◆ ActorCommon

URRActorCommon* URRStaticMeshComponent::ActorCommon = nullptr

◆ bIsStationary

bool URRStaticMeshComponent::bIsStationary = false

◆ bMeshRuntimeCreated

bool URRStaticMeshComponent::bMeshRuntimeCreated = false

◆ bUseComplexCollision

bool URRStaticMeshComponent::bUseComplexCollision = false

Whether a complex collision mesh is built alongside the visual static mesh.

Meant for ECollisionTraceFlag::CTF_UseComplexAsSimple, which only works with ECollisionChannel::ECC_WorldStatic

UPROPERTY()

◆ bUseDefaultSimpleCollision

bool URRStaticMeshComponent::bUseDefaultSimpleCollision = true

Whether static mesh is built with simple collision, also configurable in ARRMeshActor::Initialize()

UPROPERTY()

◆ CUSTOM_DEPTH_STENCIL_VOID

constexpr int8 URRStaticMeshComponent::CUSTOM_DEPTH_STENCIL_VOID = 0
staticconstexpr

◆ MeshUniqueName

FString URRStaticMeshComponent::MeshUniqueName

◆ OnMeshCreationDone

FOnMeshCreationDone URRStaticMeshComponent::OnMeshCreationDone

◆ OriginRelativeTransform

FTransform URRStaticMeshComponent::OriginRelativeTransform

◆ SceneInstanceId

int8 URRStaticMeshComponent::SceneInstanceId = 0

◆ ShapeType

ERRShapeType URRStaticMeshComponent::ShapeType = ERRShapeType::NONE

◆ StaticMeshTimerHandle

FTimerHandle URRStaticMeshComponent::StaticMeshTimerHandle
private

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