Ninja Bear Studio Plugins Help

Forward Reference

Certain usage scenarios, such as a top-down game with WASD movement will require an anchor that can be used as a reference to the movement inputs. For such cases a Forward Reference is necessary.

The Forward Reference is a Scene Component that always points North (or Positive X), instead of following the character rotation. This means it has absolute rotation.

The most common Scene Components for this are a Camera or an Arrow Component.

Providing the Forward Reference

You can provide your own Forward Reference by tagging a Scene Component with InputForwardReference. By doing so, the Input Manager Component will acquire and store this reference, when the Pawn is possessed.

Forward Arrow Reference
public: APluginLabsCharacter(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); private: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = true)) TObjectPtr<UArrowComponent> ForwardReference;

#include "Components/ArrowComponent.h" #include "Components/NinjaInputManagerComponent.h" ANinjaFrameworkCharacter::ANinjaFrameworkCharacter(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { ForwardReference = CreateDefaultSubobject<UArrowComponent>(TEXT("ForwardReference")); ForwardReference->ComponentTags.Add(UNinjaInputManagerComponent::ForwardReferenceTag); ForwardReference->SetVisibleFlag(false); ForwardReference->SetUsingAbsoluteRotation(true); ForwardReference->SetWorldRotation(FRotator::ZeroRotator); ForwardReference->SetArrowColor(FLinearColor::Green); ForwardReference->SetAutoActivate(true); ForwardReference->SetupAttachment(GetRootComponent()); }

Automatic Creation

The Input Manager can create a Forward Reference automatically. For that, you need to mark the appropriate option, bShouldCreateForwardReference.

When that property is enabled, the Input Manager will attempt to find a Forward Reference first and if none was found, it will create an Arrow Component.

Overriding the Default Scene Component

If you need to modify or completely change the Scene Component created by the Input Manger, override the CreateForwardReference function, either in Blueprints or C++.

Last modified: 16 September 2024