Download

Camera Orbiting around different clickable Pawns

Hi there,

Pretty new to Unreal Engine 4 but I have been working in the game industry for the past 7 years, mainly developing 2D games, I’ve been trying to get my head around the following type of feature:

The idea is that you have a bunch of visible Pawns on the scene that are clickable. On click, I would like the camera to travel toward the clicked actor, and be able to orbit around it the same way we orbit around the character in the Third-Person example. Think like Sins of a Solar Empire where you can click different ships and orbit around them in space.

How would one go by to implement such feature? Would you create a Blueprint class from Actor that contains a Spring Arm along with a Camera, and change the position to the clicked target? (That’s mainly what I’ve been trying to do without much success, the camera does move to the desired location, but doesn’t seem to respond anymore to Turn or Look Inputs from the mouse movement, to orbit around)
Would there be a more appropriate way to do this? Just a normal camera and re-implement myself the orbit functionality without a Spring Arm?

Thanks in advance for your suggestions.

After some more research this came up as a fair solution:

How do you do an orbit without a spring arm on a pawn with an existing movementComponent?

Most flexible way is to create separate pawns (without camera) and one spectator like camera pawn (that is player controlled).
If you add spring arm to that spectator pawn and enable slight lag it will nicely approximate and smooth all stuttering.
Now on event tick snap that camera pawn to selected pawn rotation. Because of laggy camera arm viewport will move smoothly.

You can also do all above with separate camera for each pawn, then possesing them when selected (there are nodes for cinematic camera transitions).
But i think my way of snapping same camera to different pawns is less hassle.

Here is a blueprint that shows how to orbit anything with a vector3 around something else with a vector3, aka orbit any actor around any other actor/pawn/object etc.

It would be great if there was a function like this built into UE4.

https://answers.unrealengine.com/questions/337727/how-to-make-object-rotate-around-another-object.html

The collision component is my pawn. This blueprint lets you rotate your pawn around a specified vector3, your vector3 is the world location of the object you want to rotate/revolve around.
5675d664836c77522fcb2375cc4108682801d705.jpeg

For years man has yearned to rotate objects around other objects in UE4, now that dream is a reality.