Examples of RigidBodyControl


Examples of com.jme3.bullet.control.RigidBodyControl

    ball_geo.setMaterial(stone_mat);
    rootNode.attachChild(ball_geo);
    /** Position the cannon ball */
    ball_geo.setLocalTranslation(cam.getLocation());
    /** Make the ball physcial with a mass > 0.0f */
    ball_phy = new RigidBodyControl(1f);
    /** Add physical ball to physics space. */
    ball_geo.addControl(ball_phy);
    bulletAppState.getPhysicsSpace().add(ball_phy);
    /** Accelerate the physcial ball to shoot it. */
    ball_phy.setLinearVelocity(cam.getDirection().mult(25));
View Full Code Here

Examples of com.jme3.bullet.control.RigidBodyControl

    sceneModel.setLocalScale(2f);

    // We set up collision detection for the scene by creating a
    // compound collision shape and a static RigidBodyControl with mass zero.
    CollisionShape sceneShape = CollisionShapeFactory.createMeshShape(sceneModel);
    landscape = new RigidBodyControl(sceneShape, 0);
    sceneModel.addControl(landscape);

    // We set up collision detection for the player by creating
    // a capsule collision shape and a CharacterControl.
    // The CharacterControl offers extra settings for
View Full Code Here

Examples of com.jme3.bullet.control.RigidBodyControl

     *
     * @param spatial the rootnode containing the physics objects
     */
    public void addAll(Spatial spatial) {
        if (spatial.getControl(RigidBodyControl.class) != null) {
            RigidBodyControl physicsNode = spatial.getControl(RigidBodyControl.class);
            physicsNode.setPhysicsSpace(this);
            //add joints
            List<PhysicsJoint> joints = physicsNode.getJoints();
            for (Iterator<PhysicsJoint> it1 = joints.iterator(); it1.hasNext();) {
                PhysicsJoint physicsJoint = it1.next();
                //add connected physicsnodes if they are not already added
                if (physicsJoint.getBodyA() instanceof PhysicsControl) {
                    add(physicsJoint.getBodyA());
View Full Code Here

Examples of com.jme3.bullet.control.RigidBodyControl

     *
     * @param spatial the rootnode containing the physics objects
     */
    public void removeAll(Spatial spatial) {
        if (spatial.getControl(RigidBodyControl.class) != null) {
            RigidBodyControl physicsNode = spatial.getControl(RigidBodyControl.class);
            physicsNode.setPhysicsSpace(null);
            //remove joints
            List<PhysicsJoint> joints = physicsNode.getJoints();
            for (Iterator<PhysicsJoint> it1 = joints.iterator(); it1.hasNext();) {
                PhysicsJoint physicsJoint = it1.next();
                //add connected physicsnodes if they are not already added
                if (physicsJoint.getBodyA() instanceof PhysicsControl) {
                    remove(physicsJoint.getBodyA());
View Full Code Here

Examples of com.jme3.bullet.control.RigidBodyControl

    rootNode.attachChild(SkyBoxFactory.createSimpleSkyBox(assetManager));

    CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);

    vehicleControl = new RigidBodyControl(capsuleShape, 1f);
    vehicleControl.setKinematic(false);
    player = new Player(assetManager);
    player.setLocalTranslation(0.0f, -5.0f, -2.0f);

    bulletAppState.getPhysicsSpace().setGravity(Vector3f.ZERO);
View Full Code Here

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

Examples of com.jme3.bullet.control.RigidBodyControl

    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

Examples of com.jme3.bullet.control.RigidBodyControl

    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

Examples of com.jme3.bullet.control.RigidBodyControl

    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

Examples of com.jme3.bullet.control.RigidBodyControl

    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
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.