Skip to content

UAndromedaPlacementModeComponent

Kind: class Source: Source/Andromeda/Player/AndromedaPlacementModeComponent.h Base classes: UActorComponent

Details

Actor component that previews and commits freeform placement of the held actor.

Protected Properties

Member Type Summary
PlacementTraceDistance float Maximum camera trace distance for placement targeting.
PlacementTraceChannel TEnumAsByte< ECollisionChannel > Collision channel used by placement traces.
RotationStepDegrees float Degrees applied for each rotation input unit.
ValidGhostMaterial TObjectPtr< UMaterialInterface > Optional material override applied to valid placement previews.
InvalidGhostMaterial TObjectPtr< UMaterialInterface > Optional material override applied to invalid placement previews.
WarningGhostMaterial TObjectPtr< UMaterialInterface > Optional material override applied to warning placement previews.
bPlacementModeActive bool Runtime flag controlling whether preview mode is active.
PlacementPreviewState EAndromedaPlacementPreviewState Current validation state for the preview transform.
RotationAxis EAndromedaPlacementRotationAxis Current axis affected by AdjustPlacementRotation.
PlacementRotationOffset FRotator Runtime rotation delta layered over the held actor's current rotation.
CurrentPlacementTransform FTransform Last computed target transform for preview and commit.
GhostMeshComponent TObjectPtr< UStaticMeshComponent > Runtime-only static mesh component used as the placement preview ghost.

Public Methods

Member Type Summary
UAndromedaPlacementModeComponent function Enables ticking support but starts disabled until placement mode is active.
IsPlacementModeActive bool Returns whether placement preview mode is active.
TogglePlacementMode void Starts placement mode or cancels an active preview.
BeginPlacementMode void Starts preview mode when carry, camera, and ghost dependencies are valid.
CancelPlacementMode void Stops preview mode, disables tick, marks state invalid, and hides the ghost mesh.
TryCommitPlacement bool Places the held actor when the current preview is acceptable.
CycleRotationAxis void Cycles the rotation axis from yaw to pitch to roll.
AdjustPlacementRotation void Applies configured rotation steps on the active axis.

Protected Methods

Member Type Summary
OnRegister void Creates the hidden runtime ghost mesh component during registration.
OnUnregister void Cancels placement and destroys the runtime ghost mesh component.
TickComponent void Refreshes the preview while placement mode is active.
CreateGhostMeshComponent void Creates the runtime ghost mesh component if it does not already exist.
RefreshPlacementPreview void Traces, computes target transform, evaluates state, and updates ghost presentation.
SyncGhostMeshToHeldItem void Copies preview mesh and scale from the held carryable object.
UpdateGhostPresentation void Moves the ghost and applies state materials or original preview materials.
HideGhost void Hides the preview mesh when it exists.
EvaluatePlacementPreviewState EAndromedaPlacementPreviewState Returns invalid, warning, or valid for the current transform.
IsLocationInsideStation bool Checks whether a world point is inside any station access volume by iterating through all stations and calling their AAndromedaStation::IsWorldLocationInStationAccess() functions.
WouldOverlapBlockingGeometry bool Runs the oriented placement overlap query for the held actor.

Private Methods

Member Type Summary
GetOwningAndromedaCharacter AAndromedaCharacter * Returns the required owning Andromeda character.
GetPlacementCamera UCameraComponent * Returns the owning character's placement camera.
GetCarryComponent UAndromedaCarryComponent * Returns the owning character's carry component.

Members

PlacementTraceDistance

float PlacementTraceDistance

Maximum camera trace distance for placement targeting.

PlacementTraceChannel

TEnumAsByte< ECollisionChannel > PlacementTraceChannel

Collision channel used by placement traces.

RotationStepDegrees

float RotationStepDegrees

Degrees applied for each rotation input unit.

ValidGhostMaterial

TObjectPtr< UMaterialInterface > ValidGhostMaterial

Optional material override applied to valid placement previews.

InvalidGhostMaterial

TObjectPtr< UMaterialInterface > InvalidGhostMaterial

Optional material override applied to invalid placement previews.

WarningGhostMaterial

TObjectPtr< UMaterialInterface > WarningGhostMaterial

Optional material override applied to warning placement previews.

bPlacementModeActive

bool bPlacementModeActive

Runtime flag controlling whether preview mode is active.

PlacementPreviewState

EAndromedaPlacementPreviewState PlacementPreviewState

Current validation state for the preview transform.

RotationAxis

EAndromedaPlacementRotationAxis RotationAxis

Current axis affected by AdjustPlacementRotation.

PlacementRotationOffset

FRotator PlacementRotationOffset

Runtime rotation delta layered over the held actor's current rotation.

CurrentPlacementTransform

FTransform CurrentPlacementTransform

Last computed target transform for preview and commit.

GhostMeshComponent

TObjectPtr< UStaticMeshComponent > GhostMeshComponent

Runtime-only static mesh component used as the placement preview ghost.

UAndromedaPlacementModeComponent

UAndromedaPlacementModeComponent::UAndromedaPlacementModeComponent()

Enables ticking support but starts disabled until placement mode is active.

IsPlacementModeActive

bool UAndromedaPlacementModeComponent::IsPlacementModeActive() const

Returns whether placement preview mode is active.

Returns:

True when preview mode is active and tick may refresh placement.

TogglePlacementMode

void UAndromedaPlacementModeComponent::TogglePlacementMode()

Starts placement mode or cancels an active preview.

BeginPlacementMode

void UAndromedaPlacementModeComponent::BeginPlacementMode()

Starts preview mode when carry, camera, and ghost dependencies are valid.

This resets rotation state to yaw/zero offset, enables tick, syncs the ghost to the held carryable object, and refreshes the first preview.

CancelPlacementMode

void UAndromedaPlacementModeComponent::CancelPlacementMode()

Stops preview mode, disables tick, marks state invalid, and hides the ghost mesh.

TryCommitPlacement

bool UAndromedaPlacementModeComponent::TryCommitPlacement()

Places the held actor when the current preview is acceptable.

The method refreshes the preview, rejects invalid previews or missing carry state, releases the held actor at CurrentPlacementTransform, broadcasts a placement commit event, and cancels placement mode on success.

Returns:

True when the held actor was placed.

CycleRotationAxis

void UAndromedaPlacementModeComponent::CycleRotationAxis()

Cycles the rotation axis from yaw to pitch to roll.

AdjustPlacementRotation

void UAndromedaPlacementModeComponent::AdjustPlacementRotation(float InputValue)

Applies configured rotation steps on the active axis.

No work is performed while placement mode is inactive or InputValue is nearly zero.

Parameters:

Name Type Description
InputValue float Signed input units multiplied by RotationStepDegrees.

OnRegister

void UAndromedaPlacementModeComponent::OnRegister() override

Creates the hidden runtime ghost mesh component during registration.

OnUnregister

void UAndromedaPlacementModeComponent::OnUnregister() override

Cancels placement and destroys the runtime ghost mesh component.

TickComponent

void UAndromedaPlacementModeComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override

Refreshes the preview while placement mode is active.

Parameters:

Name Type Description
DeltaTime float
TickType ELevelTick
ThisTickFunction FActorComponentTickFunction *

CreateGhostMeshComponent

void UAndromedaPlacementModeComponent::CreateGhostMeshComponent()

Creates the runtime ghost mesh component if it does not already exist.

RefreshPlacementPreview

void UAndromedaPlacementModeComponent::RefreshPlacementPreview()

Traces, computes target transform, evaluates state, and updates ghost presentation.

SyncGhostMeshToHeldItem

void UAndromedaPlacementModeComponent::SyncGhostMeshToHeldItem()

Copies preview mesh and scale from the held carryable object.

UpdateGhostPresentation

void UAndromedaPlacementModeComponent::UpdateGhostPresentation()

Moves the ghost and applies state materials or original preview materials.

HideGhost

void UAndromedaPlacementModeComponent::HideGhost()

Hides the preview mesh when it exists.

EvaluatePlacementPreviewState

EAndromedaPlacementPreviewState UAndromedaPlacementModeComponent::EvaluatePlacementPreviewState(const AAndromedaWorkstation *PreviewWorkstation) const

Returns invalid, warning, or valid for the current transform.

Invalid means the object is missing, not carryable, outside station access, or overlaps blocking geometry. Warning means PreviewWorkstation exists but rejects the transform.

Parameters:

Name Type Description
PreviewWorkstation const AAndromedaWorkstation * Workstation under the current placement trace, if any.

Returns:

Preview state used for ghost presentation and commit rules.

IsLocationInsideStation

bool UAndromedaPlacementModeComponent::IsLocationInsideStation(const FVector &WorldLocation) const

Checks whether a world point is inside any station access volume by iterating through all stations and calling their AAndromedaStation::IsWorldLocationInStationAccess() functions.

Parameters:

Name Type Description
WorldLocation const FVector & Candidate world location.

Returns:

True when any station reports the location inside station access.

WouldOverlapBlockingGeometry

bool UAndromedaPlacementModeComponent::WouldOverlapBlockingGeometry(const FTransform &CandidateTransform) const

Runs the oriented placement overlap query for the held actor.

The query uses the held actor's placement bounds and placement collision channel while ignoring the actor returned by IAndromedaCarryableInterface::GetPlacementIgnoredActor().

Parameters:

Name Type Description
CandidateTransform const FTransform & World transform to test.

Returns:

True when the candidate would overlap blocking geometry.

GetOwningAndromedaCharacter

AAndromedaCharacter * UAndromedaPlacementModeComponent::GetOwningAndromedaCharacter() const

Returns the required owning Andromeda character.

Returns:

Character that owns this component, or nullptr if the component is attached elsewhere.

GetPlacementCamera

UCameraComponent * UAndromedaPlacementModeComponent::GetPlacementCamera() const

Returns the owning character's placement camera.

Returns:

First-person camera used for placement traces, or nullptr.

GetCarryComponent

UAndromedaCarryComponent * UAndromedaPlacementModeComponent::GetCarryComponent() const

Returns the owning character's carry component.

Returns:

Carry component that supplies and releases the held actor, or nullptr.