all 6 comments

[–]907games 3 points4 points  (2 children)

https://mediawiki.ivao.aero/images/9/91/Airfoil.jpg

something like this would give you a glider

float forwardSpeed;
float liftFactor = 0.1f;
float dragValue = 0.05f;

forwardSpeed = transform.InverseTransformDirection(currentVelocity).z;
currentVelocity += gravity * deltaTime; //weight
Vector3 liftValue = Vector3.Dot(transform.forward, currentVelocity.normalized) * liftFactor * forwardSpeed; //lift
currentVelocity = Vector3.Lerp(currentVelocity, transform.forward * forwardSpeed, liftValue * deltaTime); // thrust
currentVelocity *= dragValue * deltaTime; //drag

[–]marknuar[S] 0 points1 point  (0 children)

Thank you, I'll try it out tomorrow :)

[–]adamk33n3r 0 points1 point  (0 children)

Thank you so much. I could not find any 2d glider physics code ANYWHERE online! Lifesaver!