hello fellas
i watch some videos about RTS camera and characters movement, but its not the same, and i still cant make character and camera moves separately
can u please provide me a simple tutorial to make a MOBA-type camera and character movement, with free-movement camera, which i can center to a character by pressing a specific button, like in this video?
Hey there @SAMYAZA! Welcome to the community! This tutorial series goes over a basic setup kind of like that, but you’d need to tweak it a bit. You’d have to set a control to lock back onto a focused actor instead of just clicks.
Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.
thank you
this is a really good tutorial, but not exactly for my case
i have a camera_pawn with screen-edges scrolling and zoom, which is work fine from start
but, when i choose a character to play, i lost control to camera_pawn, when character is possessed
how to regain control to camera_pawn, when the character is possessed?
i tried different things, like attach/detach camera from character to camera_pawn, but dont succeed
with this logic camera jump to camera_pawn position once, but not regain controll
That’s the fun part, when your camera is your pawn you need to send orders down the line to those you control, but you cannot possess them otherwise you lose control of the camera pawn.
With MOBAs you control 1 character, so they can be a child of your controller here just fine. Basically you’d have a BP pawn with a root, and this camera setup as a child of it. Then you would have the selected character also be a child of the root. This way, nothing moves with each other in a parent/child scenario, and you can handle all of your character logic with you. You can even do this modularly if you were to attach the character’s after the fact kind of how the FPS template adds and sends commands to the guns.
thank you for your advices
tell me please, bcz i dont find the answer
can i possess more, than one pawn at the same time?
can i detach spring_arm and camera components from possessed character, to move them separately?
because i need more, than one unit to control at the same time, and ability to use vehicles and mounts
You cannot possess more than one pawn at once, if you need to give orders to multiple you’re going to want to use event dispatchers and other things of that nature.
If the camera is attached to the character, spring arm or not, it will move with them. You can adjust this with relative location changes, but it’s often better to go with the Camera being what your movement controls and your buttons dispatching orders.
I can get a full RTS tutorial that can go over that style a bit more for you if you’d prefer, you’d just have to alter it to be more like a MOBA.
Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.
(The series is so many parts)
i’m following this official instructions
they say
“If you want to switch between multiple Playable Characters in your game or you have a situation where you want a Character to enter and control a Vehicle (car, plane, tank, etc.) or other Pawn that has unique controls (like a mounted machine gun a player can control), you will want to take Possession of the Character or Pawn in order to pass input information to it.”
this is exactly what i need
If the camera is attached to the character, spring arm or not, it will move with them.
of course, obviously, because its attached
but, can i detach spring_arm with a camera from possessed character, and attach it to camera_pawn to operate?
I follow both of these video tutorials, and have mixed results and feelings about this.
Movement, which i got for selected units, is much worse, then movement of possessed character with enhanced input actions.
This logic of Posession works fine.
Selected units is slowly rotate to the point, where they need to go, before they start moving, what is drastically dysfunctional, when mouse button is held and cursor is moving - unit just rotate at one place, mostly.
Second, units lost an animation of movement, they just slide, same time possessed character works completely fine.
This logic, from RTS-style picking units tutorial, works much worse.
Then, i find a kinda strange, why i need to use this crutch method, instead of default “Possession” instrument, which is work fine and official explanations about it says it is what i need.
Is it really right thing to do and the only way? I’ll better stick to Possession.
The official documentation is usually referring to games that are single character (or swapping between single characters), where if you’re pressing WASD you’re moving the character, and your camera at once, and when you swap to say a vehicle or a mounted weapon, you then possess that for control. It’s not intended to control multiple at once, and when you attempt to it fails. With possession, you control one actor anyway, so if you need to grab a group of units, how do you handle it?
of course, obviously, because its attached
but, can i detach spring_arm with a camera from possessed character, and attach it to camera_pawn to operate?
You can detach it and reattach it to other things, but you would then be handling attachments of the camera repeatedly, and this is entirely fine for something where you’re handling only one entity at a time. Though if you have more than one unit, your inputs won’t be read at all except on the pawn you possess.
I agree that the tutorials don’t do exactly what’d be needed for this use case, I usually give resources that can be built upon and adjusted for specific use cases. They were more of a “as close as I can explain the concept without writing up a MOBA camera system”. There’s no “right” way in this case, if possession seems better for your use case, go for it! It’s more based on keeping different component sets compartmentalized and modular so it’s easier for you to add content later down the line. Which you can still 100% do with the possession style.
- 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).
-
Basics:
-
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.
-
Camera Focus and Zoom logic. U need to make it yourself. It has a references to
MOBA_fighting_unit
component Sping Arm, calledSpring Arm Base
.
-
(and 5) Edge-Screen scrolling logic. U need to make it, and, again, same
MOBA_fighting_unit
component referenceSpring Arm Base
.
U need to useMouseX
andMouseY
event nodes, instead of Enhanced Input Action nodes in this case, because EIA system seems buggy with mouse events.
Up/Down.
- 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:
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 (;