Freelancer like camera and controls

Hey guys,

currently working on a space project. I want Freelancer-like controls and camera. Many other games have similar ones. For example Star Conflict.

I’ve tried a few things but none of them seem to get close to what I want.

Any ideas or approaches on how to make such controls/camera?

Okay so I’ve worked a few things out. Wasnt actually that hard. Its still WIP but works:


I’m basically getting the players position on the screen, subtracting it by the mouse position and then divide the rest by the half of screen width/height.
Then it gets multiplied by the yaw/pitch rate. So the further the mouse is away from the player, the faster it rotates. Alternatively, if you want to have equal ranges in x/y axis
you can take the width and height of the screen, subtract it from mouse position and so on. That ensures that the distance is always calculated from the center of the screen
instead of the objects position. Since I dont know how to get the invert boolean of the MouseY axis, I simply multiplied the Y axis with -1.
I will post more screens when I made new progress if someone is interested in this.

i am interested in this any news ?

Im not sure if it’s really like freelancer the way i have set up but it works well.
So you want make a 2d vector of the middle of your viewport, then you get your mouse position in the screen, take the delta of mouse position and middle screen position and you can add rotation from there.

In my case there is a zone in the middle that doesn’t make the pawn rotate and i add the Yaw in world space so it doesn’t make your brain go crazy :slight_smile:

Sorry have finals this week. I’m going to work on this next weekend. Stay tuned!

I’m also interested in this, you should keep us posted. :wink:

Super quick update:

As you probably can see, I’ve added a check that ensures that the BP always uses the smaller viewport-axis for calculation. It can be possible for a player to have a portrait-oriented Monitor(1080x1920).
Basically, this method makes the area quadratic instead of rectangular. Any value bigger than 1 gets clamped to the max-range/1 so the ship doesnt go crazy on e.g. 4K-resolutions.

I’m currently working on the “leaning”-effect of the pawn you can see in Freelancer. The ship rolls a bit to the right/left the farther the cursor is away from the center of the screen. As of right now, it still uses the auto-orientation feature from the template. Also a boost-effect and a simple UMG HUD with a notice that the mouse-steering is wether active or not is in the works. I’m currently not entirely sure how I handle rolling at all beside the leaning-effect. Since Gimbal-Lock is still present in the standard implementation(I assume it at least, please correct me), it requires Quaternions or another solution and I’m pretty bad at more complex math :smiley: Also, the original Freelancer didn’t include any manual rolling feature.

When I’m finished with this thing, I’ll upload it of course, even though its quite easy to do^^

Next update:
Leaning and the boost are working. However, the default calculation for the movement is very annoying, which makes it hard to add a boost, since it doesn’t rely on physics movement like addForce and such. So the implementation of the boost feature is kinda… a dirty workaround. I’m currently reworking the movement calculation. So I’m only sharing the leaning BP in this update.

The leaning effect:

The result is plugged in into a SetActorRotation node.

Hey Dude, Would it be possible to get a tutorial or maybe some pictures or a copy of the box code you made to get this working, I’ve tried myself but I am new to using the unreal engine and also have next to no experience when it comes to game development, any and all help would be appreciated .