- Home /
Flight physics
Hey guys I'm trying to make more or less realistic flight physics. To achieve that I wrote a script that gets the forward speed of the plane and calculates the lift for that wing it is attached to.
void FixedUpdate () {
float realSpeed = plane.velocity.z;// m/s
float lift = liftCoefficient*(airDensity/2)*Mathf.Pow(realSpeed, 2) * liftSurface;
Debug.Log(lift);
plane.AddForceAtPosition(Vector3.up*lift/100, transform.position);
}
I have two of those scripts: one in the back for the smaller wings and one in the front for the bigger wings. But the plane weiredly starts going up and down the whole time. Rotates to an x rotation of 80 and back to a rotation of 40. I even checked: there is no way why it should do that since the forces applied as lift are constantly the same at the same speed (of course the lift is higher for the bigger wing than for the smaller one).
I think that the problem is that the forces get applied after each other: bigger wing -> plane goes up to 80° smaller wing -> plane goes back down to 40° I'm not sure though.
How could I solve that problem? Or do you have another/better idea for creating good plane physics (they don't have to be realistic, they should just let the player think that it's more or less realistic)
Edit: my guess was wrong: when I take away the wing script from one wing the other wing script still makes it spinning up and down.
Your answer
Follow this Question
Related Questions
Increase Speed in Gameplay 4 Answers
Flight Simulator - Return To Original Height 0 Answers
Need help with 2D Flight Simulator 0 Answers
Flight HUD - flight angles 0 Answers
JSBSim and Unity 0 Answers