How to constantly move one actor smoothly
Hi. So this is the scenario:
I have two actors(player characters) that are constantly moving in random diretions and a camera that simply finds the center of both players and set itself in that location
but sometimes the players teleport to other locations and that changes instantatly the center of both characters wich means the camera too, and that just looks bad.
How can i make the camera follow the center of both characters smoothly.
asked Dec 12 '18 at 02:20 AM in Blueprint Scripting
You can use Camera Boom (Spring Arm Component) to have nice smooth camera location transitions.
In the component enable the camera lag and set it to desired value (lower == slower):
When having the camera on your character (you can see the UE example TopDown or ThirdPerson templates to see how it's added there) you can use it like that, e.g. in EventTick or in some timer:
Then the camera will follow the middle point smoothly, even in case of player teleport. I've tested it, here is how it looks like, with sudden player teleport included:
You can also use the SpringArmComponent Target Arm Length to add some zoom in/out depending on your Player1 <---> Player2 distance.
answered Dec 12 '18 at 03:56 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here