Download

Airplane controls

Hello.

Im trying to control airplane with WASD controls for some reasons… (like joystick)
Im using A D for roll rotation and i want to use W S for pitch rotation. However, when i turn my airplane with A S to 90°, then pitch rotation is not “pitch” rotation, but roll rotation… I want to lift up nose of airplane with pitch control input, but it lift up one of its wings because pitch rotation of controller is somehow not changed when im using roll rotation…

Can someone help me how to control airplane with roll rotation? Im intermediate blueprinter but i really dont have idea how to do it… Or some tutorial, i not found anything…

Can we see how you’re rotating the aeroplane?

Yes of course, here is BP:

This means player cannot rotate camera with his mouse, he needs to use only keyboard to control airplane… pitch works when roll is 0, but when roll is 90, i cannot use “pitch” for “world yaw” rotation… :slight_smile: i dont know how to deal with this, because pitch control rotation is not changed in world space when i change roll…

set local rotation instead of world rotation :slight_smile:

Look in the starter content for the UFO flying example. You want the pitch value of your actors local rotation, if you think about it if your plane has rolled 90 degree’s, up in world rotation is not up in your local rotation :slight_smile:

You can get the different vectors straight from your actor to do this better with some built in nodes. there’s a ‘get up vector’ from your actor (or a component depending on your setup), that will give you your actors yaw value. also there’s a forward vector which you can use to get your roll value and a left/right vector for pitch.

Hi thanks, i looked at that ufo starter content and now it working with local rotations… however i found that controlling of airplane is so bad when comes to roll rotations… i must find some way how to fix it

EDIT: My solution:
Im not 100% satysfied, its really complicated to control but this is the best what i found after 2 days of testing so i hope it helps someone.

really bad how, elaborate a bit I might be able to suggest something :slight_smile:

To be honest the UFO thing is pretty gash really it needs to be a bit more complicated than that if you want to make a good flight system, I just thought I’d point you in that direction as a starting point as it’ll make stuff make more sense.

Personally I use physics for this sort of thing rather than directly setting the rotation by the controller, it feels a bit better as you can mess around with the angular and linear damping in the physics settings on your component to get the feel you need.

Here’s the turning function on a project of mine, this bit is probably quite similar to the UFO bit in all honesty.

So the roll input, yaw input and and pitch input variables is pretty much the same as what you’re doing with ‘InputAxis MoveRight’ etc, I don’t usually access those values from the pawn I’d push them from the controller but essentially it’ll be the same value as whatever you’re getting using ‘InputAxis’.

The ‘pitch/yaw/roll rate’ is the turning amount.

Multiple these values together then multiple that value by ‘get world delta seconds’ to get your final value. This should then equate to for example, pitch rate per second (i think, it’s been a while and I’m sure someone will correct me if I’m wrong).

Create a vector to store the pitch, roll and yaw values, now you can use that vector to set the ‘angular velocity’, which is basically using physics to turn your aeroplane rather than setting the rotation directly.

f148adda9b9490c0f348b360324264ad0213b230.png

Here’s a quick 50 second capture I just did to show you, excuse the lack of eye candy and rubbish capture settings I couldn’t really be bothered to mess about the capture settings :slight_smile:

and no I didn’t make the models and no I’m not making a Star Wars game before the C&D posse pipe up :wink:

[video]https://youtu.be/vSoXrVWdpLk[/video]

Wow nice :slight_smile: you using keyboard for controlling right? I tested mine setup with mouse atm but i prefer keyboard but that aiming is so difficult and in my project i want to shoot players on ground (1-2k velocity) from my jet fighter :smiley: im afraid it will be impossible…

Btw some weeks ago i tried physics velocity flying but it was so “uncompatible” with characters :slight_smile:
But anyway that flying is only small part of my third person shooter…

I was using a pad on that capture but yeah it’s set it up for the keyboard aswell using a combination of W,S,A,D for pitch and yaw, Q and E for rolling. Also mapped stuff to the numbpad so there’s a few combinations depending on what you fancy,works pretty much the same apart from you have to sort of quick tap the keyboard for small increments as the input from the keyboard is always 1. I grew up playing a specccy 48k so I don’t mind it, not sure how a newer generation would take to using the keyboard :slight_smile:

But yeah its not really easy to pitch, roll, yaw, manage the throttle and fire all at the same using they keyboard. Maybe get a wired xbox 360 pad on the cheap would be my advice :slight_smile:

it would be best with a joystick but that’s another conversation :slight_smile:

Not tried making character pawns fly. The old UDK method was to stick the state into ‘flying’ and then pretty much do what I’ve done in my screenshot.

On UE4 could you stick the character into simulate physics mode like you do when you go into a ragdoll then use my method above to control the movement? That would just make a flying ragdoll I suppose but it would look funny :slight_smile:

How about something like this, I don’t really know much about the character stuff but I imagine you can pose the model whilst having the physics still running?

[video]https://youtu.be/lUKev_HppDI[/video]

Is there a way to embed a video?

Here’s one driven by the foot bone, for no reason other than it made me chuckle for 10 seconds.

https://youtu.be/SoPFoK8CXNI

https://youtube.com/watch?v=SoPFoK8CXNI

Use the full link.

Ok cheers :slight_smile: