Package com.jme3.scene.shape

Examples of com.jme3.scene.shape.Box


        if (debugNode == null) {
            debugNode = new Node();
            Material m = assetManager.loadMaterial("Common/Materials/RedColor.j3m");
            for (Iterator<Vector3f> it = spline.getControlPoints().iterator(); it.hasNext();) {
                Vector3f cp = it.next();
                Geometry geo = new Geometry("box", new Box(cp, 0.3f, 0.3f, 0.3f));
                geo.setMaterial(m);
                debugNode.attachChild(geo);

            }
            switch (spline.getType()) {
View Full Code Here


    rootNode.addLight(sun);

    // Platform
    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    material.setTexture("ColorMap", assetManager.loadTexture("Textures/concrete_cracked.jpeg"));
    Box floorBox = new Box(PLATFORM_DIMENSION, WALL_DIMENSION, PLATFORM_DIMENSION);
    Geometry floorGeometry = new Geometry("Floor", floorBox);
    floorGeometry.setMaterial(material);
    floorGeometry.setLocalTranslation(0, -WALL_DIMENSION, 0); // shift it down so the platform surface is at y = 0

    // Walls
    Material northwallmaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    northwallmaterial.setTexture("ColorMap", assetManager.loadTexture("Textures/concrete_cracked_north.jpg"));
    Material southwallmaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    southwallmaterial.setTexture("ColorMap", assetManager.loadTexture("Textures/concrete_cracked_south.jpg"));
    Material eastwallmaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    eastwallmaterial.setTexture("ColorMap", assetManager.loadTexture("Textures/concrete_cracked_east.jpg"));
    Material westwallmaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    westwallmaterial.setTexture("ColorMap", assetManager.loadTexture("Textures/concrete_cracked_west.jpg"));

    Box northWallBox = new Box(PLATFORM_DIMENSION, WALL_DIMENSION, WALL_DIMENSION);
    Box southWallBox = new Box(PLATFORM_DIMENSION, WALL_DIMENSION, WALL_DIMENSION);
    Box eastWallBox = new Box(WALL_DIMENSION, WALL_DIMENSION, PLATFORM_DIMENSION);
    Box westWallBox = new Box(WALL_DIMENSION, WALL_DIMENSION, PLATFORM_DIMENSION);
    Geometry northWallGeom = new Geometry("Wall", northWallBox);
    Geometry southWallGeom = new Geometry("Wall", southWallBox);
    Geometry eastWallGeom = new Geometry("Wall", eastWallBox);
    Geometry westWallGeom = new Geometry("Wall", westWallBox);
    northWallGeom.setMaterial(northwallmaterial);
View Full Code Here

    rootNode.addLight(light);

    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    material.setTexture("ColorMap", assetManager.loadTexture("Textures/concrete_cracked.jpg"));

    Box floorBox = new Box(20, 0.25f, 20);
    Geometry floorGeometry = new Geometry("Floor", floorBox);
    floorGeometry.setMaterial(material);
    floorGeometry.setLocalTranslation(0, -2, 0);

    // Plane plane = new Plane();
    // plane.setOriginNormal(new Vector3f(0, 0.25f, 0), Vector3f.UNIT_Y);
    // floorGeometry.addControl(new RigidBodyControl(new PlaneCollisionShape(plane), 0));
    floorGeometry.addControl(new RigidBodyControl(0));
    rootNode.attachChild(floorGeometry);
    space.add(floorGeometry);

    // movable boxes
    for (int i = 0; i < 12; i++) {
      Box box = new Box(0.25f, 0.25f, 0.25f);
      Geometry boxGeometry = new Geometry("Box", box);
      boxGeometry.setMaterial(material);
      boxGeometry.setLocalTranslation(i, 5, -3);
      // RigidBodyControl automatically uses box collision shapes when attached to single geometry with box mesh
      boxGeometry.addControl(new RigidBodyControl(2));
View Full Code Here

    rootNode.addLight(light);

    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    material.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));

    Box floorBox = new Box(140, 0.25f, 140);
    Geometry floorGeometry = new Geometry("Floor", floorBox);
    floorGeometry.setMaterial(material);
    floorGeometry.setLocalTranslation(0, -0.25f, 0);
    // Plane plane = new Plane();
    // plane.setOriginNormal(new Vector3f(0, 0.25f, 0), Vector3f.UNIT_Y);
    // floorGeometry.addControl(new RigidBodyControl(new PlaneCollisionShape(plane), 0));
    floorGeometry.addControl(new RigidBodyControl(0));
    rootNode.attachChild(floorGeometry);
    space.add(floorGeometry);

    // movable spheres
    for (int i = 0; i < 5; i++) {
      Sphere sphere = new Sphere(16, 16, .5f);
      Geometry ballGeometry = new Geometry("Soccer ball", sphere);
      ballGeometry.setMaterial(material);
      ballGeometry.setLocalTranslation(i, 2, -3);
      // RigidBodyControl automatically uses Sphere collision shapes when attached to single geometry with sphere mesh
      ballGeometry.addControl(new RigidBodyControl(.001f));
      ballGeometry.getControl(RigidBodyControl.class).setRestitution(1);
      rootNode.attachChild(ballGeometry);
      space.add(ballGeometry);
    }

    // immovable Box with mesh collision shape
    Box box = new Box(1, 1, 1);
    Geometry boxGeometry = new Geometry("Box", box);
    boxGeometry.setMaterial(material);
    boxGeometry.setLocalTranslation(4, 1, 2);
    boxGeometry.addControl(new RigidBodyControl(new MeshCollisionShape(box), 0));
    rootNode.attachChild(boxGeometry);
View Full Code Here

   */
  public static Geometry createPhysicsTestBox(AssetManager assetManager) {

    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    material.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
    Box box = new Box(0.25f, 0.25f, 0.25f);
    Geometry boxGeometry = new Geometry("Box", box);
    boxGeometry.setMaterial(material);
    // RigidBodyControl automatically uses box collision shapes when attached to single geometry with box mesh
    boxGeometry.addControl(new RigidBodyControl(2));
    return boxGeometry;
View Full Code Here

    groundMat = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
    groundMat.setColor("Color", color);

    spatial = new Node(identifier);

    Geometry geom = new Geometry(identifier, new Box(Vector3f.ZERO, radius, 0, radius));
    geom.setMaterial(groundMat);
    geom.setShadowMode(ShadowMode.Receive);
    ((Node)spatial).attachChild(geom);

    // shape = new PlaneCollisionShape(new Plane(Vector3f.UNIT_Y, 0));
View Full Code Here

  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));
View Full Code Here

    // the thickness perpendicular to the plane of the ramp.
    Vector3f baseCenter = base.clone().subtractLocal(0.0f, thickness / 2.0f, 0.0f);
    Vector3f topCenter = top.clone().subtractLocal(0.0f, thickness / 2.0f, 0.0f);
    Vector3f midPoint = baseCenter.interpolate(topCenter, 0.5f);

    spatial = new Geometry(identifier, new Box(Vector3f.ZERO, width / 2.0f, thickness / 2.0f, length / 2.0f));
    spatial.setMaterial(world.materialForColor(color));
    spatial.setLocalTranslation(midPoint);
    spatial.setLocalRotation(rotation);

    initializePhysics(spatial);
View Full Code Here

    }

    private Node createMachineNode() {
        Node machine = new Node("machine");

        Geometry table = new Geometry("table", new Box(600 / 2, 12.7f / 2, 600 / 2));
        table.setMaterial(roughAluminumTexture);
        machine.attachChild(table);
       
        Geometry pcb = new Geometry("pcb", new Box(20, 1.57f / 2, 20));
        pcb.setMaterial(pcbTexture);
        pcb.move(-100, 12.7f / 2 + 1.57f / 2, 100);
        machine.attachChild(pcb);

        Geometry yRailLeft = new Geometry("y_rail_left", new Box(6, 6, 600 / 2));
        yRailLeft.setMaterial(polishedStainlessTexture);
        yRailLeft.move(-300 + 6, 12.7f, 0);
        machine.attachChild(yRailLeft);

        Geometry yRailRight = new Geometry("y_rail_right", new Box(6, 6, 600 / 2));
        yRailRight.setMaterial(polishedStainlessTexture);
        yRailRight.move(300 - 6, 12.7f, 0);
        machine.attachChild(yRailRight);

        Node gantry = createGantryNode();
View Full Code Here

    }

    private Node createGantryNode() {
        Node gantry = new Node("gantry");

        Geometry gantryTube = new Geometry("gantry_tube", new Box(600 / 2, 50 / 2, 50 / 2));
        gantryTube.setMaterial(brushedAluminumTexture);
        gantry.attachChild(gantryTube);

        Geometry xRail = new Geometry("x_rail", new Box(600 / 2, 12 / 2, 12 / 2));
        xRail.setMaterial(polishedStainlessTexture);
        xRail.move(0, 0, 25 + 6);
        gantry.attachChild(xRail);

        Node head = createHeadNode();
View Full Code Here

TOP

Related Classes of com.jme3.scene.shape.Box

Copyright © 2018 www.massapicom. 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.