Simulate an airplane trajectory using Yuka

I’m trying to create a path for a model airplane to fly along. So far, I’ve managed to get the airplane to follow the path using Yuka (A library that allows a model to follow a trajectory) and rotate on the X (Pitch axis) and Y (Yaw axis) to create the curves and go up and down. Now I need to be able to rotate the airplane on the Z (Roll axis), but I don’t know how. I’m using a function to synchronize the Yuka vehicle with my model, and this way, Yuka’s rotation is copied. Does anyone know how to do something like this? In short, I want an airplane to follow a drawn path and be able to rotate on the Z (Roll axis). Ideally, I would like the points that generate Yuka’s path to be rotatable, keeping in mind that the rotation would create a curved path.

Can you rephrase your question using yaw, pitch and roll axes?
Also, the term “Yuka” is not commonly known.

1 Like

Thanks for the improvement suggestion. Best regards!

Yuka is apparently designed by Mugen87, a frequent contributor to this site. (And now that I look at it, maybe something I should use.) But, like you, I do not see a pathing program for airplanes.

I have been working on modules to help programmers to create a realistic flight simulation. I have also created some air and ocean traffic which follow simple paths - nothing too detailed yet. My GitHub page is here.

It should not take a lot to create your own simple pathing program for an airplane. I would just need to know what parameters you are using (.e.g. time or distance). This is something I need to do myself because I plan to add an air combat element to my flight demo - or perhaps we can convince Mugen to expand Yuka to do that. :grinning_face:

1 Like

I think there is a feature request for this topic:

Are you looking for that?

So 3D Pathfinding has not been implemented?

What about 3D Pathing - where you just follow a defined path in 3D? That may be all that David_Gamboa is looking for.

But, even here, one challenge with implementing 3D Pathing for an airplane is that the direction of pitch (X-axis) and yaw (Y-axis) change with bank (Z-axis). In my case, after years of struggling with Napier equations, I discovered that I could solve this quite easily in three.js using 2 linked meshes (each with an YXZ rotation order).

No, navigation only works with navigation meshes so far. The issue at GitHub is about a different navigation model that allows an alternative way to retrieve navigation paths to follow.

When this topic is only about steering, then the OP already follows the recommended workflow which is using the follow-path steering behavior. I think it would be easier to see the current result in action and then describe or visualize the expected behavior. I’m not sure under what conditions a roll of the vehicle is wanted.

If I may jump in as a biker and licensed paraglider pilot:

A roll is always executed when the pilot deviates from a straight-line yaw path, regardless of its direction. You don’t (have to) roll while doing a “looping” (pitch rotation). It’s what the TO called “banking” or a biker considers “leaning” into a curve.

The banking (or “roll”, “lean”) is the result of a vector addition of centrifugal and gravitational (and/or lifting) forces acting on a vehicles center of gravity.

The angle of roll (bank, lean) is proportional to the velocity (along the current tangent to its path) squared, divided by the current radius of curvature of the vehicle’s path:

Schräglage2

with
v [m/s]: velocity
g [m/s^^2]: gravitational constant
r [m]: radius of curvature

Here is the kind of pitch, yaw and bank motion that I had in mind.

In level flight, your bank angle will determine your turn rate - which you can compute using a variation of the above formula. You can see that here.

Mugen87: I would be glad to assist in developing the code for 3D pathing or limited forms of 3D pathfinding for Yuka if that would help. It should not be that difficult and can be done in a normal XYZ reference system.

Thanks so much for the feedback. I’ll try using Yuca on an empty object containing the plane and applying some formula to the plane’s roll.

that’s an interesting take :joy:

Does the bank angle precede the turn rate, or does the turn rate cause a bank angle?

Bank angle determines the turn rate. When you bank, you are deflecting lift horizontally, which causes the turn. At the same time, you need to increase total lift to generate enough vertical lift to remain in level flight. Where the bank angle is too big, this becomes impossible, so you end up in a descending turn. (See Fig 2 above for an example of this result.)