Grid Placement System
Core System
DirectionalArrowComponent

DirectionalArrowComponent

The DirectionalArrowComponent provides visual directional feedback during object placement in the Grid Placement System. It displays a 3D arrow that indicates the "front" or orientation direction of placeable objects, helping users understand how objects will be oriented when placed.

DirectionalArrowView

Overview

This component uses a hierarchical structure where the SceneComponent acts as a rotatable pivot, and a child StaticMeshComponent displays the actual arrow mesh. This design allows for flexible positioning and rotation of the directional indicator without affecting the parent object.

Component Architecture

DirectionalArrowComponent (SceneComponent)
└── ArrowMeshComponent (StaticMeshComponent)
    ├── Arrow Mesh Asset
    ├── Dynamic Material
    └── Collision: Disabled

Key Features

  • Hierarchical Design - SceneComponent pivot with mesh child for flexible control
  • Multiple Directions - Forward, Backward, Left, Right, or Custom angle
  • Dynamic Materials - Runtime color and visibility changes
  • Placement Integration - Seamlessly works with Grid Placement System
  • Performance Optimized - Only visible during placement mode

Setup

Adding to Your Placeable Objects

  1. Add Component to Blueprint:
    • Open your placeable object Blueprint
    • Add DirectionalArrowComponent as a component
    • Position it as a child of your root component
DirectionalArrowView
  1. Implement PlaceableObjectInterface:
// In your placeable object Blueprint or C++ class
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Direction")
UDirectionalArrowComponent* GetArrowComponent() const;
   
// Implementation should return your DirectionalArrowComponent
RemainingDirectionalArrow
  1. Configure Direction Settings:
    • Set Arrow Direction to match your object's "front"
    • Adjust Arrow Distance From Center for proper positioning
    • Fine-tune Arrow Scale for visibility
ArrowSettings

Configuration Properties

Arrow Settings

PropertyTypeDefaultDescription
Arrow ScaleFloat1.0Scale multiplier for the arrow mesh
Arrow DirectionEArrowDirectionForwardWhich direction the arrow points relative to the object
Custom Direction AngleFloat0.0Custom angle in degrees (only used when Arrow Direction = Custom)
Arrow Distance From CenterFloat50.0Distance from object center to arrow position
Arrow Height OffsetFloat0.5Vertical offset above the placement surface

Arrow Mesh

PropertyTypeDescription
Arrow Mesh ReferenceSoft Object ReferenceReference to the arrow mesh asset (auto-loaded from plugin)

Arrow Direction Options

EArrowDirection Enum

DirectionDescriptionUse Case
ForwardArrow points in object's forward directionDefault for most objects
BackwardArrow points in object's backward directionObjects with rear-facing functionality
RightArrow points to object's right sideSide-oriented objects
LeftArrow points to object's left sideSide-oriented objects
CustomArrow points at custom angleObjects with specific orientation needs

Direction Examples

// For a chair (seat faces forward)
ArrowDirection = EArrowDirection::Forward
 
// For a wall-mounted TV (screen faces outward from wall)
ArrowDirection = EArrowDirection::Forward
 
// For a desk lamp (light cone direction)
ArrowDirection = EArrowDirection::Forward
 
// For an object with 45-degree angle requirement
ArrowDirection = EArrowDirection::Custom
CustomDirectionAngle = 45.0f

Blueprint API

Note: You only need to use this API if necessary.
The Placement System already manages hide/unhide operations seamlessly.

Visibility Control

SetArrowVisibility

UFUNCTION(BlueprintCallable, Category = "Arrow")
void SetArrowVisibility(bool bNewVisible);

Controls arrow visibility.

Parameters:

  • bNewVisible - true to show arrow, false to hide

IsArrowVisible

UFUNCTION(BlueprintPure, Category = "Arrow")
bool IsArrowVisible() const;

Returns current arrow visibility state.

HideArrowCompletely

void HideArrowCompletely();

Completely hides the arrow and clears all materials.

ShowArrowWithMaterial

void ShowArrowWithMaterial(UMaterialInstanceDynamic* MaterialInstance);

Shows the arrow with a specific dynamic material instance.

Material Management

SetArrowMaterial

UFUNCTION(BlueprintCallable, Category = "Arrow")
void SetArrowMaterial(UMaterialInstanceDynamic* MaterialInstance);

Applies a dynamic material instance to the arrow.

Parameters:

  • MaterialInstance - Dynamic material to apply (usually from placement system)

ClearArrowMaterial

UFUNCTION(BlueprintCallable, Category = "Arrow")
void ClearArrowMaterial();

Removes the current material and hides the arrow.

SetArrowColor

UFUNCTION(BlueprintCallable, Category = "Arrow")
void SetArrowColor(const FLinearColor& Color);

Sets the arrow color by creating a dynamic material instance.

Parameters:

  • Color - Linear color for the arrow

Direction and Positioning

SetArrowDirection

UFUNCTION(BlueprintCallable, Category = "Arrow")
void SetArrowDirection(EArrowDirection Direction);

Changes the arrow direction at runtime.

SetArrowDistanceFromOverlay

UFUNCTION(BlueprintCallable, Category = "Arrow")
void SetArrowDistanceFromOverlay(float OverlayWidth, float OverlayHeight, float ExtraMargin = 10.0f);

Automatically calculates arrow distance based on overlay size.

Parameters:

  • OverlayWidth - Width of the placement overlay
  • OverlayHeight - Height of the placement overlay
  • ExtraMargin - Additional spacing beyond overlay bounds

Pivot Control

SetArrowPivotRotation

UFUNCTION(BlueprintCallable, Category = "Arrow")
void SetArrowPivotRotation(const FRotator& Rotation);

Rotates the entire arrow pivot (affects final arrow position).

GetArrowPivotRotation

UFUNCTION(BlueprintPure, Category = "Arrow")
FRotator GetArrowPivotRotation() const;

Returns the current pivot rotation.

Integration with Placement System

Automatic Management

The DirectionalArrowComponent is automatically managed by the Grid Placement System:

  1. During Placement Preview:
    • Arrow appears with placement overlay color
    • Updates in real-time with validity changes
    • Synchronizes with overlay material

  1. During Object Editing:
    • Arrow shows for selected objects
    • Indicates current object orientation
    • Updates with rotation changes

  1. Normal Gameplay:
    • Arrow is completely hidden
    • No performance impact
    • Materials are cleared

Material Synchronization

The arrow automatically synchronizes with the placement system's overlay material:

// Placement System automatically calls this
void ObjectManager::UpdateArrowMaterial()
{
    if (CurrentArrowComponent && OverlayDynamicMaterial)
    {
        CurrentArrowComponent->ShowArrowWithMaterial(OverlayDynamicMaterial);
    }
}

Color States

StateColorWhen
Valid PlacementGreenLocation is clear for placement
Invalid PlacementRedLocation is blocked or invalid
Precision ModeWhiteShift held for precision placement
UnknownGrayCalculating validity

Performance Considerations

Optimization Features

  1. Conditional Visibility:

    • Arrows only visible during placement/editing
    • Automatically hidden during normal gameplay
    • No draw calls when hidden
  2. Material Management:

    • Dynamic materials created only when needed
    • Materials cleared when not in use
    • Shared material instances when possible
  3. Component Lifecycle:

    • Components activate only during placement
    • Minimal memory footprint when inactive
    • Efficient mesh asset loading

Troubleshooting

Common Issues

"Arrow not showing during placement"

  • Verify GetArrowComponent() is implemented and returns valid component
  • Check that ArrowDistanceFromCenter isn't too small/large
  • Ensure object implements IPlaceableObjectInterface

"Arrow pointing wrong direction"

  • Rotate Arrow Manually
  • Check ArrowDirection setting matches object's intended front
  • For custom angles, verify CustomDirectionAngle value
  • Test with different EArrowDirection values

"Arrow too small/large"

  • Adjust ArrowScale property (1.0 = normal size)
  • Check ArrowDistanceFromCenter for positioning
  • Verify arrow mesh is loaded correctly

"Arrow appears in wrong position"

  • Ensure component is attached to correct parent
  • Check ArrowHeightOffset for surface clearance

Integration Workflow

  1. Component Setup → Add to placeable object Blueprint
  2. Direction Configuration → Set appropriate arrow direction
  3. Interface Implementation → Return component in GetArrowComponent()
  4. Fine-tuning → Adjust distance, scale, and positioning
  5. Testing → Verify arrow appears during placement

The DirectionalArrowComponent provides essential visual feedback for object orientation, making the placement experience more intuitive and professional for your users.