Examples of polarTranslation()


Examples of colonies.src.Point.polarTranslation()

    {
      // if destination not yet established, search for shelter
      if(destination == null){
        Point candidate = new Point();
        for(int i = 0; i < 10; ++i){
          candidate.polarTranslation(Utility.rng.nextRadian(), Math.PI/2, Utility.rng.nextInt(20));
          candidate.plus(citizen.posX, citizen.posY, citizen.posZ);
          Utility.terrainAdjustment(citizen.worldObj, candidate);
          if(!citizen.worldObj.canBlockSeeTheSky((int)candidate.x, (int)candidate.y, (int)candidate.z)){
            destination = candidate;
            citizen.getNavigator().tryMoveToXYZ(destination.x, destination.y, destination.z, 0.35f);
View Full Code Here

Examples of colonies.src.Point.polarTranslation()

            
          // pick a random direction at the town perimeter
          Point p = new Point(this.xCoord, this.yCoord, this.zCoord);
          Point q = new Point();
          Utility.Debug(p.toString());
          q.polarTranslation(Utility.rng.nextRadian(), (float)(Math.PI/2.2), 14d);
          p.plus(q);
          this.terrainAdjustment(p);

          // spawn mob
            newGuy.setLocationAndAngles(Math.floor(p.x), Math.floor(p.y), Math.floor(p.z), Utility.rng.nextFloat()*360.0f, 0.0f);
View Full Code Here

Examples of colonies.src.Point.polarTranslation()

      // if(world.isRemote) return;
     
      Point p = new Point();
      for(int angle = 0; angle < 32; ++angle){
        p.set(0, 0, 0);
        p.polarTranslation((float)angle/32.0 * 2*Math.PI, Math.PI/2, 14d);
        p.plus(x, y, z);
        this.terrainAdjustment(world, p);
        world.spawnParticle("reddust", p.x, p.y+0.5, p.z, -0.5,0.5,0.8);
      }
    }
View Full Code Here

Examples of colonies.src.Point.polarTranslation()

        }
       
        // move destination away from logging camp if necessary
        if(candidate.getDistance(citizen.homeTown.xCoord, citizen.homeTown.yCoord, citizen.homeTown.zCoord) < 10){
          double theta = Math.atan2(candidate.y - citizen.homeTown.yCoord, candidate.x - citizen.homeTown.xCoord);
          candidate.polarTranslation(theta, Math.PI/2, 10);
        }     
        //Utility.terrainAdjustment(citizen.worldObj, candidate);     
       
        blockID = citizen.worldObj.getBlockId((int)candidate.x, (int)candidate.y, (int)candidate.z);         
        if( blockID == Block.wood.blockID  ) //TODO: look for a tree here with leaves.
View Full Code Here

Examples of colonies.src.Point.polarTranslation()

      // Utility.chatMessage("looking for a spot to plant sapling");
      Point candidate = new Point();
      int blockID = 0;
      for(int i = 0; i < 10; ++i){
        // choose a spot 5-10m away from citizen in a random direction
        candidate.polarTranslation(Utility.rng.nextRadian(), Math.PI/2, 5 + Utility.rng.nextInt(5));
        candidate.plus(citizen.posX, citizen.posY, citizen.posZ);
       
        // move destination away from logging camp if necessary
        if(candidate.getDistance(citizen.homeTown.xCoord, citizen.homeTown.yCoord, citizen.homeTown.zCoord) < 10){
          double theta = Math.atan2(candidate.y - citizen.homeTown.yCoord, candidate.x - citizen.homeTown.xCoord);
View Full Code Here

Examples of colonies.src.Point.polarTranslation()

        candidate.plus(citizen.posX, citizen.posY, citizen.posZ);
       
        // move destination away from logging camp if necessary
        if(candidate.getDistance(citizen.homeTown.xCoord, citizen.homeTown.yCoord, citizen.homeTown.zCoord) < 10){
          double theta = Math.atan2(candidate.y - citizen.homeTown.yCoord, candidate.x - citizen.homeTown.xCoord);
          candidate.polarTranslation(theta, Math.PI/2, 10);
        }     
        Utility.terrainAdjustment(citizen.worldObj, candidate);
       
        // if we found dirt that can see sky, we're good; set navigator and return true
        if(citizen.worldObj.canBlockSeeTheSky((int)candidate.x, (int)candidate.y, (int)candidate.z)){
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.