Privvet1

Plane Force

Jun 18th, 2021
707
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class HeadFlight : MonoBehaviour
  6. {
  7.     public float airSpeed;
  8.     public float calibration;
  9.     public Rigidbody plane;
  10.     public Transform epty;
  11.     public Vector3 fDirection = new Vector3(0, 0, 0);
  12.     public float thrust = 1f;
  13.    
  14.     // Start is called before the first frame update
  15.     void Start()
  16.     {
  17.        
  18.     }
  19.     void Update()
  20.     {
  21.        
  22.     }
  23.  
  24.     // Update is called once per frame
  25.     void FixedUpdate()
  26.     {
  27.         airSpeed = plane.velocity.x * 10000f;
  28.         airSpeed = (Mathf.Round(airSpeed * 100f)) / 100.0f;
  29.         if (Input.GetKey(KeyCode.E))
  30.         {
  31.             Debug.Log("E");
  32.             plane.AddForce(fDirection.normalized * thrust, ForceMode.Force);
  33.             //plane.AddForce(fDirection * thrust, ForceMode.Acceleration);
  34.             //plane.AddForce(fDirection * thrust, ForceMode.Impulse);
  35.             //plane.AddForce(fDirection * thrust, ForceMode.VelocityChange);
  36.         }
  37.     }
  38. }
RAW Paste Data