GithubHelp home page GithubHelp logo

aircraft-physics's People

Contributors

gasgiant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aircraft-physics's Issues

Idea: Set custom Center of Mass

First of all, I wanted to thank you for publishing your great work! Thanks for providing it here on github.

Now, I have a scene in which I would like simulate the flight of a glider (without thrust). However, a lot of gliders have longer fuselages than i.e. the cessna provided in the example. Now when adding colliders for the fuselage and the tail it distorts the real center of mass. In my situation, the center of mass is behind the wings, so the glider tilts backwards during stall, which is not realistic.

I had the idea that one could provide a custom (local) center of mass vector to override the calculated CoM world vector. So in my situation I did something like this in AirplanePhysics.cs:

public bool useCustomCoM;
public Vector3 customCoM;

...

Vector3 com;
if (useCustomCoM)
{
   com = rb.transform.TransformVector(customCoM);
}
else
{
   com = rb.worldCenterOfMass;
}

// use com instead of rb.worldCenterOfMass

(This is just an example of how I tried to do it. Implementation would need to be tailored to the specific use).

However, I failed to update the gizmo drawing, since the custom CoM would also be used in AircraftGizmos.cs. Maybe someone has an idea how to solve that?

In addition, the input variable customCoM would probably be only needed when useCustomCoM is true, so one would need to create a custom unity editor script. This, however, overwrites the other fields.

Off Topic: I also wanted to ask: Is a downward elevator / tail force supported? It seems like the cessna example uses a positive lift for the tail). However, I learned that stable aircrafts use a negative lift (in the opposite direction of the wing lift), so that in case of a stall the aircraft tilts forward.

Edit:
I forgot that one could simply set rb.centerOfMass, so in effect, something like this should do the trick:

public bool useCustomCoM;
public Vector3 customCoM;

...

private void Awake()
 {
     rb = GetComponent<Rigidbody>();
     if (useCustomCoM)
     {
         rb.centerOfMass = customCoM;
     }
 }

...

#if UNITY_EDITOR
    // For gizmos drawing.
    public void CalculateCenterOfLift(out Vector3 center, out Vector3 force, Vector3 displayAirVelocity, float displayAirDensity)
    {
        Vector3 com;
        BiVector3 forceAndTorque;
        if (aerodynamicSurfaces == null)
        {
            center = Vector3.zero;
            force = Vector3.zero;
            return;
        }

        if (rb == null)
        {
            rb = GetComponent<Rigidbody>();
            if (useCustomCoM)
            {
                rb.centerOfMass = customCoM;
            }
            com = rb.worldCenterOfMass;
            forceAndTorque = CalculateAerodynamicForces(-displayAirVelocity, Vector3.zero, Vector3.zero, displayAirDensity, com);
        }
        else
        {
            if (useCustomCoM)
            {
                rb.centerOfMass = customCoM;
            }
            com = rb.worldCenterOfMass;
            forceAndTorque = currentForceAndTorque;
        }

        force = forceAndTorque.p;
        center = com + Vector3.Cross(forceAndTorque.p, forceAndTorque.q) / forceAndTorque.p.sqrMagnitude;
    }
#endif

(Sorry, not really optimized).

yaw controls

Hi!

I tried flying your plane for a bit and I love this project. At the same time, some aspects of the aircraft's behavior are not very realistic.

The most noticeable sign of flight dynamics is the aircraft's response to pressing Q / E. It feels like the deflection of the rudder only creates a side-slip angle. At the same time, there is no noticeable curvature of the trajectory, as if the angle of the lateral slip does not affect the magnitude of the lateral force.

Of course, it would be more interesting to fly with different intermediate throttle values, between 0 and 100. It is also sad that the propeller is standing still.

I'm interested in such things, and I could try to make some improvements to your model. Unfortunately, I didn't find the open access article from the conference on aerodynamics to which you refer. And I haven't gotten to know the code in detail yet. Are you going to improve the flight dynamics model? Does it make sense for me to try to make changes to the model?

How combined aspect ratio is calculated?

Hello!
So there are Wing_L_0 and Wing_L_1 stacked together, and the aspect ratio set to 7 for both. How this value is calculated, if I am doing something like this:

(span1 + span2) / ((chord1 + chord2) / 2)

I get something like 3.5. But I think I am doing this wrong.

Yaw fix?

Hi! This physics is quite good, however, I can't turn with the yaw at low speed, on the ground. I have to reach a certain amount of speed to turn on the ground. And this amount of speed is quite significant. So I tried to multiply the yaw sensitivity. But It didn't work. I'm not familiar with Unity's wheel colliders but maybe the issue come from here? Does the wheel collider rotate with the yaw movment?

simulate flat spin stall

Hi! I remember that you said : " When playing with this system I've even experieced unrecoverable spins. "
how did you done that ?
anyway to reproduce ?
I am interested in stalls and spins simuation.
thanks in advance

Why are you using padded angles and how do you get the values?

Hi, I like your project and I was looking into your code. When you calculate your aerodynamic coefficients you add padding your your stall angles. Why? And you determine the padding by lerping between 8 and 14 degrees, why 8 and 14, or did you guess these values a bit?

image

Setup for jet aircraft

Hello
What adjustments do I need to make to the plane so that both the wings are positioned correctly and it moves correctly? When I adjust the location of the wings according to the shape of the fighter, it does not move correctly.
Thanks

Idea: 2D Aircraft Physics

Hey,

Wow! This is an absolutely stunning library, well detailed, well defined and I was exetremely impressed with the amount of information spilled into it.

I don't have an issue, but I do have an idea. (I don't know how create a discussion or anything so I went here to issues)
screenshots

I want to create a very simple aircraft physics, but in 2D, so I thought about connecting and using parts of the scripts for it.
However, I don't know how to perform a reduction on your library for it, I can try, but it will take me a lot of time.
I would like to know if you could minimize it for it? or at least guide me towards my vision?

I thought about only connecting the AeroSurface for the tail and ailerons, and removing yaw and roll (I could animate the roll easily I believe), so basically all I need is pitch movement. And I'm still clueless for the 2D aerodynamics for the plane.
What do I do with the scripts so I won't get any sudden movement on an axis that shouldn't move?
Of course, assuming the plane direction is Z and Y, The plane shouldn't change it position in X in 2D world.

Thanks,
Ori

how to simlate stall ?

I wanted to simulate stall like DCS, or Lock on FC, in the F15 , Su 27 , there is always that pitch locked at high aoa(angle of attack), so how one can reproduce this https://imgur.com/a/BT6J9Yc the aoa remains high until the pilot do some manoeuver(moving the stick forward) to recover ? (because here it falls back to the velocity vector whatever I do). is there a trick that DCS or Lock on series does ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.