Package com.jme3.bullet.control

Examples of com.jme3.bullet.control.RigidBodyControl


    asteroid.setMaterial(mat_asteroid);

    rootNode.attachChild(asteroid);

    CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
    vehicleControl = new RigidBodyControl(capsuleShape, 1f);
    vehicleControl.setMass(1.0f);

    cam.setLocation(vehicleControl.getPhysicsLocation());
    cam.setRotation(vehicleControl.getPhysicsRotation());
View Full Code Here


    PlayerFactory pf = new PlayerFactory();
    pf.addControlledObject((SpaceObject) null, true);

    // Inputs laden
    RigidBodyControl playerVehicle = objectController.getPlayer().getRigidBodyControl();
    PlayerVehicleUpdates pvu = new PlayerVehicleUpdates();
    initializeInput(pvu);

    // Flugsteuerung laden
    RotationFlightAssistent rfa = new RotationFlightAssistent(playerVehicle, pvu);
View Full Code Here

    sceneObject.addLight(new PointLight());
    sceneObject.setName("PlayerShip");

    // TODO: ship: Gr��e laden
    CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1f, 2f);
    rbc = new RigidBodyControl(capsuleShape, 1f);
    rbc.setSleepingThresholds(0.01f, 0.01f);

    rbc.setSpatial(getSceneObject());
    sceneObject.addControl(rbc);
View Full Code Here

    eastWallGeom.setLocalTranslation(PLATFORM_DIMENSION + WALL_DIMENSION, 0, 0);
    westWallGeom.setLocalTranslation(-PLATFORM_DIMENSION - WALL_DIMENSION, 0, 0);

    // Add the geometries to the environment, and endow them with physical properties

    floorGeometry.addControl(new RigidBodyControl(0));
    rootNode.attachChild(floorGeometry);
    physicsSpace.add(floorGeometry);
    northWallGeom.addControl(new RigidBodyControl(0));
    rootNode.attachChild(northWallGeom);
    physicsSpace.add(northWallGeom);
    southWallGeom.addControl(new RigidBodyControl(0));
    rootNode.attachChild(southWallGeom);
    physicsSpace.add(southWallGeom);
    eastWallGeom.addControl(new RigidBodyControl(0));
    rootNode.attachChild(eastWallGeom);
    physicsSpace.add(eastWallGeom);
    westWallGeom.addControl(new RigidBodyControl(0));
    rootNode.attachChild(westWallGeom);
    physicsSpace.add(westWallGeom);

  }
View Full Code Here

    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));
      rootNode.attachChild(boxGeometry);
      space.add(boxGeometry);
    }

    // immovable sphere with mesh collision shape
    Sphere sphere = new Sphere(8, 8, 1);
    Geometry sphereGeometry = new Geometry("Sphere", sphere);
    sphereGeometry.setMaterial(material);
    sphereGeometry.setLocalTranslation(4, -4, 2);
    sphereGeometry.addControl(new RigidBodyControl(new MeshCollisionShape(sphere), 0));
    rootNode.attachChild(sphereGeometry);
    space.add(sphereGeometry);

  }
View Full Code Here

    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);
    space.add(boxGeometry);

  }
View Full Code Here

    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

    material.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
    Sphere sphere = new Sphere(8, 8, 0.25f);
    Geometry boxGeometry = new Geometry("Sphere", sphere);
    boxGeometry.setMaterial(material);
    // RigidBodyControl automatically uses sphere collision shapes when attached to single geometry with sphere mesh
    boxGeometry.addControl(new RigidBodyControl(2));
    return boxGeometry;
  }
View Full Code Here

   * @return
   */
  public static Node createPhysicsTestNode(AssetManager manager, CollisionShape shape, float mass) {

    Node node = new Node("PhysicsNode");
    RigidBodyControl control = new RigidBodyControl(shape, mass);
    node.addControl(control);
    return node;
  }
View Full Code Here

        if (name.equals("shoot") && !keyPressed) {
          Geometry bulletg = new Geometry("bullet", bullet);
          bulletg.setMaterial(mat2);
          bulletg.setShadowMode(ShadowMode.CastAndReceive);
          bulletg.setLocalTranslation(app.getCamera().getLocation());
          RigidBodyControl bulletControl = new RigidBodyControl(1);
          bulletg.addControl(bulletControl);
          bulletControl.setLinearVelocity(app.getCamera().getDirection().mult(25));
          bulletg.addControl(bulletControl);
          rootNode.attachChild(bulletg);
          space.add(bulletControl);
        }
      }
View Full Code Here

TOP

Related Classes of com.jme3.bullet.control.RigidBodyControl

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.