Package org.spout.math.vector

Examples of org.spout.math.vector.Vector3f.mul()


    // Slightly dropping upwards
    impulse = impulse.add(0.0, 0.1, 0.0);

    // Conversion factor, some sort of unit problem
    //TODO: This needs an actual value and this value might change when gravity changes!
    impulse = impulse.mul(100);

    // Finally drop using a 4 second pickup delay
    Item spawnedItem = Item.drop(dropFrom.getPosition(), item, impulse);
    spawnedItem.setUncollectableDelay(4000);
  }
View Full Code Here


    } else {
      direction = human.getHead().getLookingAt();
    }
    Entity nearest = null;
    for (double d = 0.0; d <= 50.0; d += 0.25) {
      Point pos = point.add(direction.mul(d));
      Entity near = point.getWorld().getNearestEntity(pos, player, (int) lastDistanceToEntity);
      if (near == null) {
        continue;
      }
      double distance = pos.distance(near.getPhysics().getPosition());
View Full Code Here

      // Try to shoot the item selected if we can't do anything else with it
      final Random rand = GenericMath.getRandom();
      Vector3f direction = this.getFacing(block).getOffset();

      // Calculate position to shoot from
      Point position = block.getPosition().add(direction.mul(0.6));
      VanillaEntityComponent toLaunch = null;

      // Calculate shooting velocity using facing direction
      Vector3f velocity = direction.mul(rand.nextDouble() * 0.1 + 0.2);
      // Set velocity y to above (0.2)
View Full Code Here

      VanillaEntityComponent toLaunch = null;

      // Calculate shooting velocity using facing direction
      Vector3f velocity = direction.mul(rand.nextDouble() * 0.1 + 0.2);
      // Set velocity y to above (0.2)
      velocity = velocity.mul(1.0, 0.0, 1.0).add(0.0, 0.2, 0.0);
      velocity = velocity.add(0.045 * rand.nextGaussian(), 0.045 * rand.nextGaussian(), 0.045 * rand.nextGaussian());

      Effect shootEffect;
      Material material = item.getMaterial();
      //TODO: Implement the following 'special' shoot cases:
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.