コード例 #1
0
ファイル: FlightData.cs プロジェクト: xbohov01/code_sample
        public void UpdateFlightData()
        {
            Altitude         = plane.position.y;
            Heading          = plane.rotation.y;
            HeadingDegrees   = plane.rotation.eulerAngles.y;
            Elevation        = plane.rotation.x;
            ElevationDegrees = plane.rotation.eulerAngles.x;
            Roll             = plane.rotation.z;
            RollDegrees      = plane.rotation.eulerAngles.z;
            //Airspeed in knots
            AirSpeed = plane.GetComponent <Rigidbody>().velocity.magnitude *metersToKnotsCoefficient;

            EngineStatuses = engineController.GetEngineStatuses();
            Rpm            = engineController.Rpm;
            ThrottleStatus = engineController.ThrottleBase;
            //VS in m/s
            VerticalSpeed = (plane.position.y - lastPosition.y) / Time.deltaTime;

            if (pathNavigator.NextWaypoint)
            {
                NextWaypointTransform = pathNavigator.NextWaypoint.transform;
            }

            //Update last position !HAS TO BE LAST!
            lastPosition = plane.position;
        }