MOBA camera and character movement

-    For those, who came after me   -

You don’t need an “RTS camera”, where u must use a camera_pawn, which is lost control because u possess a character to play.

It is possible to make a MOBA-style free-moving camera without camera_pawn.
Actually, with Possession its even easier.
Create your parent class for fighting units, i call it MOBA_fighting_unit, and later make all playing characters a children of this class.

The only Components of Parent class MOBA_fighting_unit u need. Decal is optional, u don`t need it to work. Also, u don’t need these events at the EventGraph, its a leftovers from RTS tutorial.

Then, u need to set Lock to Hmd of the camera in the MOBA_fighting_unit to False!

Logic, u needs in Controller:
U need 1 Vector variable CachedDestination, and 2 Float variables, ScrollSpeed (4000) & PressedThreshold (0.5).

  1. Basics:

  2. Mouse-click movement.

U have 1 and 2 in the Top-Down template, actually, just make a little adjustment to lock a mouse into game window.

  1. Camera Focus and Zoom logic. U need to make it yourself. It has a references to MOBA_fighting_unit component Sping Arm, called Spring Arm Base.

  2. (and 5) Edge-Screen scrolling logic. U need to make it, and, again, same MOBA_fighting_unit component reference Spring Arm Base.
    U need to use MouseX and MouseY event nodes, instead of Enhanced Input Action nodes in this case, because EIA system seems buggy with mouse events.

Up/Down.

  1. Left/Right.

That’s all.

Bonus:
U can use this simple logic to switch characters to see everything works fine.

Place it into Level Blueprint:
map2

If u find an errors, or find a way to correctly replace MouseX & MouseY events with a EIA nodes - ping me pls.

I hope it helps.

Have a nice day (;

1 Like