Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@modelmat
Created October 17, 2019 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save modelmat/73d65568300fb9cebbbf47377c4ad38f to your computer and use it in GitHub Desktop.
Save modelmat/73d65568300fb9cebbbf47377c4ad38f to your computer and use it in GitHub Desktop.
Ravenfield Landable Planes Script. Tested through to EA12, may work in newer versions.
/*
1. Create a bool `down` in the Plane script class.
2. Insert the below code in the methods in the Plane class.
*/
void Update() {
// Insert at the end
if (Input.GetKeyDown(KeyCode.Z) && this.seats[0].IsOccupied() && !this.seats[0].occupant.aiControlled)
{
if (this.down) {
this.down = false;
} else {
this.down = true;
}
this.animator.SetBool("landing gears", this.down);
}
}
void FixedUpdate() {
// Replace `this.rigidbody.AddForce(...)` with this.
if (this.animator.GetBool("landing gears") && !this.isAirborne && vector.z < 10f && this.seats[0].IsOccupied() && !this.seats[0].occupant.aiControlled)
{
this.rigidbody.drag = 1.5f;
this.engine.enabled = false;
}
if (SteelInput.GetAxis(SteelInput.Inputs.PlaneThrottle) < 0f && this.seats[0].IsOccupied() && !this.seats[0].occupant.aiControlled)
{
this.rigidbody.AddForce(force * 0.3f, ForceMode.Acceleration);
}
else
{
if (this.seats[0].IsOccupied() && !this.seats[0].occupant.aiControlled)
{
this.engine.enabled = true;
}
this.rigidbody.drag = 0.12f;
this.rigidbody.AddForce(force, ForceMode.Acceleration);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment