Пример #1
0
    // Use this for initialization
    void Start()
    {
        myref = gameObject.transform;

        VelController = GetComponent <VehicleVelocityController>();


        TargetWP      = Instantiate(targetWP_Mark);
        TargetWP.name = gameObject.name + "TargetWP";

        //For displaying red signs on the terrain
        WPpos = TargetWP.GetComponent <terrainAttachment>();
    }
Пример #2
0
    void pathConstraction()
    {
        for (int WP_i = 0; WP_i < PathWPs_PosesAndVels.Count; WP_i++)
        {
            if (WP_i >= PathWPs.Count)
            {
                GameObject newWP_Object = Instantiate(PathWP_Mark);
                newWP_Object.name = VehicleName + "_PathWP_" + WP_i.ToString();
                PathWPs.Add(newWP_Object);
            }

            terrainAttachment WPpos = PathWPs[WP_i].GetComponent <terrainAttachment>();
            WPpos.moveTo(new Vector3(PathWPs_PosesAndVels[WP_i].x, PathWPs_PosesAndVels[WP_i].y, 0));
        }
    }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        myref = gameObject.transform;

        shahid = GetComponent <ShahidController>();
        string shahidName = gameObject.name;

        targetWP_Mark      = Instantiate(targetWP_Mark); // creating a private copy
        targetWP_Mark.name = shahidName + "Target";
        TargetMarkPos      = targetWP_Mark.GetComponent <terrainAttachment>();

        shahidTargetPoseAndVel = new Vector3(myref.position.x, myref.position.z, 0);


        Debug.Log("ShahidWPController::Start - targetRadius is:" + targetRadius.ToString() + " shahidTargetPoseAndVel:" + shahidTargetPoseAndVel); //+myref.position);
    }
Пример #4
0
    void LeaderSetup()
    {
        foreach (var vehicleXML in file.Descendants("platform_pose"))
        {
            LeaderPose = new Vector2(float.Parse(vehicleXML.Element("initial_platform_position_on_map_X_axis").Value),
                                     float.Parse(vehicleXML.Element("initial_platform_position_on_map_Y_axis").Value));                    // * MapSize;
            LeaderAzimuth = float.Parse(vehicleXML.Element("initial_platform_azimut_on_map").Value);

            //LeaderVehicle = Instantiate(LeaderVehicleRef);

            terrainAttachment LeaderVehiclePos = LeaderVehicle.GetComponent <terrainAttachment>();
            LeaderVehiclePos.moveTo(new Vector3(LeaderPose.x, LeaderPose.y, 0.0f));
            LeaderVehicle.transform.eulerAngles = new Vector3(0, LeaderAzimuth * Mathf.Rad2Deg, 0);
            Debug.Log("Leader position:" + LeaderPose.x.ToString() + "," + LeaderPose.y.ToString());
        }
    }
Пример #5
0
    void FollowerSetup()
    {
        float FollowerDiss = 20;         //When inserted scenario doesn't exist, the distance between the two vehicle is 20 and the
                                         // lock works better  .... it was 30;
        Vector2 diffVec      = new Vector2(Mathf.Sin(LeaderAzimuth), Mathf.Cos(LeaderAzimuth)) * FollowerDiss;
        Vector2 FollowerPose = LeaderPose - diffVec;

        float FollowerAzimuth = LeaderAzimuth;

        //FollowerVehicle = Instantiate(FollowerVehicleRef);
        terrainAttachment FollowerVehiclePos = FollowerVehicle.GetComponent <terrainAttachment>();

        FollowerVehiclePos.moveTo(new Vector3(FollowerPose.x, FollowerPose.y, 0.0f));
        FollowerVehiclePos.transform.eulerAngles = new Vector3(0, FollowerAzimuth * Mathf.Rad2Deg, 0);
        Debug.Log("Follower position:" + FollowerPose.x.ToString() + "," + FollowerPose.y.ToString());
        //FollowerVehicle = oshkosh
        VehiclePathController FollowerPathController = FollowerVehicle.GetComponent <VehiclePathController>();

        FollowerPathController.PathWPs_PosesAndVels.Clear();

        VehicleFollowerPathController PathController = FollowerVehicle.GetComponent <VehicleFollowerPathController>();

        PathController.leaderVehicle = LeaderVehicle.transform;
    }