realistic flight physics function library, anyone interested?

I just noticed that in UE 4.13 click spots in sim template sometimes don’t work.
After some experimenting it turns out that getting camera location gives you location one frame ahead. Not sure if this is a bug in 4.13, or intended behavior. It doesn’t do that in UE4.12.
Either way, as a workaround you can get last camera location during the tick event, and start line traces for clickspot from that location. Not the world’s most elegant solution, but so far it seems to work reliably.

Here’s sim template for 4.13 with the fix applied: https://drive.google.com/open?id=0B20tIRBAcOlscjZKTm9RcXJrY0E

If anyone can think of a better way, please let me know.

Updated for UE4.14
Gumroad customers: get EasyFlightModel_191_414.zip
Marketplace customers: update should be automatic via launcher.

Sim_template also needed to be changed slightly, due to changes in postprocess settings
Here’s new download: https://drive.google.com/open?id=0B20tIRBAcOlsZ09XYzFCU18wZjA
As a bonus, I’ve thrown in some new cloud sprites.

Note: New wheeled vehicle physics in UE4.14 finally apply forces at correct location, so it should be possible to use it for landing gear instead of EasyGear.
I’m not going to remove EasyGear, but it’s really up to personal preference which one you’re going to use.

A quick note about next update:
As you may have heard, UE 4.14 has multiplayer world origin rebasing (thanks nkey).
Even though it’s still an experimental feature, I want to add support for it to EasyFM as quickly as possible, because it greatly expands possibilities for flight simulation.
The problem is that this means that next update will be only available for UE4.14+
I’m not going to change anything else, so if you’re on earlier version of UE you can skip this update and not miss anything.
Everyone OK with this?

I am ok with this :slight_smile:

Update is now available on Gumroad (EasyFlighModel_200_414.zip) and it’s on the way to Marketplace.

Here’s slightly modified sim_template that shows how to do MP origin rebasing: sim_template_120_414_rebase.zip - Google Drive
press J to shift client world to your current location
press K to shift server world to your current location
All relevant logic is inside the “pilot” blueprint

PS: keep in mind that this is an experimental feature, so do not rely on it too much just yet. EFM supports it, but some of your other stuff might not.

EDIT: Released on marketplace too. You should get notification about update next time you open the launcher. If not, click on “installed plugins” under UE 4.14 and “update”.

Sorry for long time without updates. 2.1 is on the way.

I replaced rotation smoothing code with better one (from SixDOF), this should remove rotation jitter in multiplayer for good.
I also did some internal refactoring of replication code, which doesn’t alter functionality, just makes code easier to read (and less opportunities to write bugs :wink: )

And finally, two new functions: GetState and SetState.
GetState will write all settings as byte array, and SetState will of course load from this array.
This can be used to store flight model in a SaveGame, or have multiple “presets” you can switch between, etc.

Quick question:

Would you mind if the next update broke backwards compatibility a little?
Namely, i’d like to update the way inputs are handled (Set Pitch Input etc).
At the moment this is done by directly setting a variable, and I want to turn that into a function.
This will allow me to replicate those inside the plugin, so you no longer have to mess with RPCs, checking for duplicate inputs, and all that nonsense.

Since UE4.15 is going to support flight sticks, this is probably the best opportunity to introduce this change.

Hey Mookiexi -

Do what you feel best for the plugin. :slight_smile:

I personally Have no objections :slight_smile:

So in short we will just have to replace the variable used (ex: throttle input), by its function?

Correct, that’s all you have to do, at least for singleplayer.

For multiplayer you can optionally remove all replication stuff in front of it (but if you want to do it the “old way” you can still call the function on the server like before).

Thanks I saw your video, it seems easy to implement.

I was wondering, is it possible to limit banking of the aircraft? Let’s say it won’t roll over -+30 degrees for example?

I don’t have a built-in function for that, but it should be relatively simple to implement it in blueprint (get bank angle and if it exceeds the limit send opposite direction into RollInput).

Or if you want something more realistic, you could implement soft/hard limit like on an Airbus. In that case you apply leveling input only if there’s no manual input in opposite direction. And when you exceed 60 degrees, manual input is disregarded and opposite direction applied always.

Thank you, I’m using GetWorldRotation to get the bank angle, but I’m confused how I can set the Roll Input to the opposite direction? Should I just say keep rotation at 30?

I’d go with something like this:

Inverted sign of roll to get the direction in which to roll
Absolute roll minus your limit, clamped so it doesn’t go below 0, and multiplied by sensitivity of the limiter (you have to give it some “slack” to prevent oscillations).
And since this is a simple limiter without any extra logic, just add it to your previous input.
And then you just stick this function between what you get from joystick and what you send to easyfm

Thank you very much, it works perfectly!

Hey @moookiexl -

Got a few questions -

Currently I am making a combined arms combat game with your easy flight model plugin.
However I am running into the following issue which I am hoping you might be able to help me with.

I need a hook of sorts for my aircraft so that I can slow down the velocity of the aircraft to a stop when they land on the deck of my Aircraft Carrier.
So basically I need an function and/or component that I can call when I land the aircraft on the deck of my Aircraft Carrier that slows down the aircraft to a stop.

On the opposite end of the spectrum I need some kind of catapult function and/or Component to thrust the aircraft forward momentarily in order to get enough momentum to take flight off an aircraft carrier’s deck.

So Currently - I am testing this on an stationary box - I have not set up the buoyancy model yet. Since Aircraft carriers are designed to operate in almost any weather condition at sea. I need the aircraft to stick to the carrier deck until they take off. I have yet to try this with the ocean plugin. This will be part of the next steps when I solve the hook and catapult problems.

I will let you know If I run into more problems.

If you could help it would be appreciated. :slight_smile:

HeadClot

PS - A helicopter plugin would be awesome and I would pay for that.

If you want to make sure it’s stuck to the deck you could either manually update location each step (to move into a position of some socket or something), and to reset velocity.
Or just attach it to the other actor and disable physics.

For taxiing on the deck, gravity should be enough to keep it on (if the carrier is also physics body, otherwise the gear component has no way to know its velocity and it might end up sliding off).

For catapult and wire, i’d simply put a trigger volume on the ship, and if the plane is in it, use AddForceAtLocation (location being a socket on the plane) to launch/stop it. While EFM is just fine with you directly setting component velocity, AddForceAtLocation is just more realistic way of doing things IMO.

Look at the size of the node! rofl

That’s nothing, you should see what it looked like inside :wink:


Deciding to simplify it and port it in C++ was probably a good idea in the end :slight_smile:

2.2 is now out.

Changes:
-New input replication
-Increased physics stability
-Should work with blueprint nativization
-Internal refactoring (renamed confusing variable names, removed dead code, marked functions without side effects as const)

Should also work with 4.15 preview (you’ll have to recompile it of course).

I decided to make it still possible to set inputs directly, to maintain backwards compatibility - but consider it deprecated, and likely to get removed some time in the future.
This is how you should do it now: