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.

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
- Add Component to Blueprint:
- Open your placeable object Blueprint
- Add
DirectionalArrowComponent
as a component - Position it as a child of your root component

- Implement PlaceableObjectInterface:
// In your placeable object Blueprint or C++ class
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Direction")
UDirectionalArrowComponent* GetArrowComponent() const;
// Implementation should return your DirectionalArrowComponent

- 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

Configuration Properties
Arrow Settings
Property | Type | Default | Description |
---|---|---|---|
Arrow Scale | Float | 1.0 | Scale multiplier for the arrow mesh |
Arrow Direction | EArrowDirection | Forward | Which direction the arrow points relative to the object |
Custom Direction Angle | Float | 0.0 | Custom angle in degrees (only used when Arrow Direction = Custom) |
Arrow Distance From Center | Float | 50.0 | Distance from object center to arrow position |
Arrow Height Offset | Float | 0.5 | Vertical offset above the placement surface |
Arrow Mesh
Property | Type | Description |
---|---|---|
Arrow Mesh Reference | Soft Object Reference | Reference to the arrow mesh asset (auto-loaded from plugin) |
Arrow Direction Options
EArrowDirection Enum
Direction | Description | Use Case |
---|---|---|
Forward | Arrow points in object's forward direction | Default for most objects |
Backward | Arrow points in object's backward direction | Objects with rear-facing functionality |
Right | Arrow points to object's right side | Side-oriented objects |
Left | Arrow points to object's left side | Side-oriented objects |
Custom | Arrow points at custom angle | Objects 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 overlayOverlayHeight
- Height of the placement overlayExtraMargin
- 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:
- During Placement Preview:
- Arrow appears with placement overlay color
- Updates in real-time with validity changes
- Synchronizes with overlay material
- During Object Editing:
- Arrow shows for selected objects
- Indicates current object orientation
- Updates with rotation changes
- 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
State | Color | When |
---|---|---|
Valid Placement | Green | Location is clear for placement |
Invalid Placement | Red | Location is blocked or invalid |
Precision Mode | White | Shift held for precision placement |
Unknown | Gray | Calculating validity |
Performance Considerations
Optimization Features
-
Conditional Visibility:
- Arrows only visible during placement/editing
- Automatically hidden during normal gameplay
- No draw calls when hidden
-
Material Management:
- Dynamic materials created only when needed
- Materials cleared when not in use
- Shared material instances when possible
-
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
- Component Setup → Add to placeable object Blueprint
- Direction Configuration → Set appropriate arrow direction
- Interface Implementation → Return component in
GetArrowComponent()
- Fine-tuning → Adjust distance, scale, and positioning
- 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.