Ejemplo n.º 1
0
 public ExperimentSetup(System.Type redirector, System.Type resetter, VirtualPathGenerator.PathSeed pathSeed, TrackingSizeShape trackingSizeShape, InitialConfiguration initialConfiguration, Vector3 gainScaleFactor)
 {
     this.redirector           = redirector;
     this.resetter             = resetter;
     this.pathSeed             = pathSeed;
     this.trackingSizeShape    = trackingSizeShape;
     this.initialConfiguration = initialConfiguration;
     this.gainScaleFactor      = gainScaleFactor;
 }
Ejemplo n.º 2
0
    public void Initialize()
    {
        this.initialPosition = Vector2.zero;
        this.initialForward  = Vector2.up;

        // Initialize according to the motion type
        if (this.movementController == MotionManager.MovementController.AutoPilot)
        {
            this.DISTANCE_TO_WAYPOINT_THRESHOLD = 0.05f;// 0.0001f;

            // Setup waypoints and pathseed
            InstantiateSimulationPrefab();

            switch (condPath)
            {
            case VirtualPathGenerator.PathSeedChoice.Office:
                currentPathSeed = VirtualPathGenerator.getPathSeedOfficeBuilding();
                break;

            case VirtualPathGenerator.PathSeedChoice.ExplorationSmall:
                currentPathSeed = VirtualPathGenerator.getPathSeedExplorationSmall();
                break;

            case VirtualPathGenerator.PathSeedChoice.ExplorationLarge:
                currentPathSeed = VirtualPathGenerator.getPathSeedExplorationLarge();
                break;

            case VirtualPathGenerator.PathSeedChoice.LongWalk:
                currentPathSeed = VirtualPathGenerator.getPathSeedLongCorridor();
                break;

            case VirtualPathGenerator.PathSeedChoice.ZigZag:
                currentPathSeed = VirtualPathGenerator.getPathSeedZigzag();
                break;

            case VirtualPathGenerator.PathSeedChoice.Maze:
                this.waypoints = VirtualPathGenerator.getPathSeedMaze();
                break;
            }

            if (condPath != VirtualPathGenerator.PathSeedChoice.Maze)
            {
                float sumOfDistances, sumOfRotations;
                this.waypoints = VirtualPathGenerator.generatePath(currentPathSeed, initialPosition, initialForward, out sumOfDistances, out sumOfRotations);
                Debug.Log("MOTION sumOfDistances: " + sumOfDistances);
                Debug.Log("MOTION sumOfRotations: " + sumOfRotations);
            }


            // Set First Waypoint Position and Enable It
            this.targetWaypoint.position = new Vector3(this.waypoints[0].x, this.targetWaypoint.position.y, this.waypoints[0].y);
            this.waypointIterator        = 0;
            this.targetWaypoint.gameObject.SetActive(true);
            Debug.Log("First waypoint initialized");
        }
    }