Ejemplo n.º 1
0
    protected override void OnCreate()
    {
        ReachabilityConstraint maxReach = CreateReachabilityConstraint(robotBase.transform.position, maxRobotReachability, ReachabilityConstraint.LimitType.max);
        ReachabilityConstraint minReach = CreateReachabilityConstraint(robotBase.transform.position, minRobotReachability, ReachabilityConstraint.LimitType.min);

        placer = new SurfaceObjectPlacer(plane, random, minReach, maxReach, maxPlacementTries);
    }
Ejemplo n.º 2
0
    private static Rect MaxReachabilityPlacementZone(ReachabilityConstraint maxRobotReachability)
    {
        float x    = maxRobotReachability.robotX - maxRobotReachability.robotReachabilityLimit;
        float z    = maxRobotReachability.robotZ - maxRobotReachability.robotReachabilityLimit;
        float size = maxRobotReachability.robotReachabilityLimit * 2;

        return(new Rect(x, z, size, size));
    }
Ejemplo n.º 3
0
    public static ReachabilityConstraint CreateReachabilityConstraint(Vector3 robotBasePosition, float limit, ReachabilityConstraint.LimitType limitType)
    {
        ReachabilityConstraint constraint = new ReachabilityConstraint();

        constraint.robotX    = robotBasePosition.x;
        constraint.robotZ    = robotBasePosition.z;
        constraint.limitType = limitType;
        constraint.robotReachabilityLimit = limit;
        return(constraint);
    }
Ejemplo n.º 4
0
 public SurfaceObjectPlacer(
     GameObject plane,
     FloatParameter random,
     ReachabilityConstraint minRobotReachability,
     ReachabilityConstraint maxRobotReachability,
     int maxPlacementTries)
 {
     this.plane  = plane;
     this.random = random;
     this.minRobotReachability = minRobotReachability;
     this.maxRobotReachability = maxRobotReachability;
     this.maxPlacementTries    = maxPlacementTries;
 }