Top-Down Components¶
Overview¶
Top-down gameplay uses UMIPTopDownPlayerControllerComponent for input (LMB, space bar, WASD, ability actions), movement (TryMoveToActor, TryMoveToLocation), cursor hit (trace and sort for hittable actors), and rotation toward cursor. UMIPTopDownPathFollowingComponent extends UPathFollowingComponent and aborts move when WASD is triggered; it follows the path segment with custom behavior and references the player character and controller.
Key traits:
- UMIPTopDownPlayerControllerComponent – Handles left-click (move/ability), space bar, WASD move, ability action triggered/completed; broadcasts OnCursorHitTargetDelegate (FMIPCursorHitInfo); SetControllerRotationToLocation for look-at-cursor.
- UMIPTopDownPathFollowingComponent – Attached to pawn; AbortMoveOnWASDTriggered; FollowPathSegment override; OnPossessedPawnChanged.
All paths below are relative to Plugins/ModularInventoryPlus/Source/ModularInventoryPlus/.
Key Classes & Files¶
| Class | File |
|---|---|
UMIPTopDownPlayerControllerComponent |
Public/TopDown/MIPTopDownPlayerControllerComponent.h |
UMIPTopDownPathFollowingComponent |
Public/TopDown/MIPTopDownPathFollowingComponent.h |
UMIPTopDownPlayerControllerComponent¶
- Base: UMIPBasePlayerControllerComponent.
- Delegate:
OnCursorHitTargetDelegate(FMIPCursorHitInfo). - API:
HandleLMBTriggered(InAbilityTag),HandleSpaceBarTriggered(),HandleLeftClick(),TryMoveToActor(InActor),TryMoveToLocation(InTargetLocation),HandleAbilityActionTriggered(InAbilityTag),HandleAbilityActionCompleted(),SetControllerRotationToLocation(InLocation),OnWASDInputMoveTriggered(),OnWASDInputMoveCompleted(). Uses trace/sort for GetFirstHittableActorFromSortedResult / TraceAndFindHitActorWithSorting. - Integration: UMIPCursorComponent, UMIPObjectOutlineManager subscribe to cursor hit; UMIPInteractionComponent and ability system for move/ability.
UMIPTopDownPathFollowingComponent¶
- Base: UPathFollowingComponent (Navigation).
- Attachment: Pawn (character movement).
- API:
AbortMoveOnWASDTriggered()– stop path following when player uses WASD. OverrideFollowPathSegment(DeltaTime). - Refs: MIPPlayerCharacter, MIPPlayerController (for abort and behavior).
Integration¶
- Cursor hit is shared by outline, cursor component, and ability targeting.
- Movement: AI/PathFollowing uses this component; WASD takes precedence and aborts current path.