예제 #1
0
    void Awake()
    {
        instance = this;
        Physics.autoSimulation = false;

        analytics = new AircraftAnalytics(airplane, airplane.transform);

        ArgumentParser argParser = new ArgumentParser();

        argParser.AddArgument("-targetFrameRate", false, "50");
        argParser.AddArgument("-portAgentSend", false, "26001");
        argParser.AddArgument("-portAgentReceive", false, "26000");
        argParser.AddArgument("-trees", false, "1");
        argParser.AddArgument("-difficulty", false, "1.0");
        argParser.AddArgument("-actionFrequency", false, "1");
        argParser.AddArgument("-windAngle", false, "0");
        argParser.AddArgument("-windPower", false, "2.5");
        argParser.AddArgument("-windAngleDeviation", false, "25");
        argParser.AddArgument("-penaltyActionCoefficient", false, "0.000");
        argParser.AddArgument("-penaltyTimeCoefficient", false, "0.00000");
        argParser.AddArgument("-limitMode", false, "0");
        argParser.ParseArguments();

        difficulty                   = argParser.arguments["-difficulty"].valueFloat;
        limitMode                    = argParser.arguments["-limitMode"].valueInt;
        actionFrequency              = argParser.arguments["-actionFrequency"].valueInt;
        penaltyActionCoefficient     = argParser.arguments["-penaltyActionCoefficient"].valueFloat;
        penaltyTimeCoefficient       = argParser.arguments["-penaltyTimeCoefficient"].valueFloat;
        FlightWind.windPower         = argParser.arguments["-windPower"].valueFloat;
        FlightWind.windMean          = FlightWind.windPower;
        FlightWind.pitchDeviationMax = argParser.arguments["-windAngleDeviation"].valueFloat;
        FlightWind.yawDeviationMax   = argParser.arguments["-windAngleDeviation"].valueFloat;
        FlightWind.SetWindDirection(argParser.arguments["-windAngle"].valueFloat);
        Application.targetFrameRate = argParser.GetIntArgument("-targetFrameRate");
        QualitySettings.vSyncCount  = 0;

        externalAgent    = argParser.arguments["-portAgentSend"].isSupplied && argParser.arguments["-portAgentReceive"].isSupplied;
        portAgentSend    = argParser.arguments["-portAgentSend"].valueInt;
        portAgentReceive = argParser.arguments["-portAgentReceive"].valueInt;

        if (externalAgent)
        {
            agentController = new BoxExternalAgentController(observationDimension, actionDimension, portAgentSend, portAgentReceive);
        }
        else
        {
            agentController = new FlightHumanAgentController(flightInputReader);
        }

        if (argParser.arguments["-trees"].valueInt == 1)
        {
            treeGenerator.enabled = true;
        }
    }
예제 #2
0
    public Force GetForce(Rigidbody rigidbody)
    {
        Vector3 worldPosition = parent.TransformPoint(localPosition);

        return(GetForce(rigidbody.GetPointVelocity(worldPosition) - FlightWind.GetWind(worldPosition), worldPosition));
    }