Package javara.world.physical

Source Code of javara.world.physical.Block

package javara.world.physical;

import javara.world.PhysicalObject;
import javara.world.World;

import com.jme3.math.ColorRGBA;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;

public class Block extends PhysicalObject {
  public static float DEFAULT_YAW = 0, DEFAULT_PITCH = 0, DEFAULT_ROLL = 0;
  public static Vector3f DEFAULT_SIZE = new Vector3f(2, 2, 2);

  public Block(World world, Vector3f center, Vector3f size, ColorRGBA color, float yaw, float pitch, float roll, float mass, boolean isHologram) {
    super(mass, isHologram, color);

    spatial = new Geometry(identifier, new Box(Vector3f.ZERO, size.x / 2.0f, size.y / 2.0f, size.z / 2.0f));
    spatial.setMaterial(world.materialForColor(color));
    spatial.rotate(yaw, pitch, roll);
    spatial.setLocalTranslation(center);
    spatial.setLocalRotation(new Quaternion().fromAngles(pitch, yaw, roll));

    initializePhysics(spatial);
  }
}
TOP

Related Classes of javara.world.physical.Block

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.