Package com.bulletphysics.collision.shapes

Examples of com.bulletphysics.collision.shapes.BoxShape


    DemoEnvironment3Dv2 env = new DemoEnvironment3Dv2(0, params);
   
   
   
    // Erst die CollisionShapes erzeugen.
    BoxShape ground = new BoxShape(new Vector3f(25f, 1f, 5f));
    SphereShape sphere = new SphereShape(1f);
    // Dann die Shapes in einer Liste speichern.
    env.getCollisionShapes().add(ground);
    env.getCollisionShapes().add(sphere);
   
View Full Code Here


   
    GroundAgent groundAgent = new GroundAgent(idCounter++, env);
    groundAgent.getRigidBody().setRestitution(.65f);
    env.addAgent(groundAgent);
   
    BoxShape endElementShape = new BoxShape (endElementSize);
    BoxShape elementShape = new BoxShape (elementSize);
   
    env.getCollisionShapes().add(endElementShape);
    env.getCollisionShapes().add(elementShape);
   
    BridgeAgent endAgentLeft = new BridgeAgent(
View Full Code Here

   
    ////////////////////////////////
    ///// FEDER
    ///////////////////////////////
   
    BoxShape armShape = new BoxShape(new Vector3f (5,0.5f,0.5f));
    SphereShape gewichtShape = new SphereShape (1);
    env.getCollisionShapes().add(armShape);
    env.getCollisionShapes().add(gewichtShape);
   
    ConstraintDemoAgent armAgent1 = new ConstraintDemoAgent(
        idCounter++,
        env,
        env.getCollisionShapes().getQuick(0),
        new Vector3f (5,1,0),
        null,
        0.1f);
   
    ConstraintDemoAgent armAgent2 = new ConstraintDemoAgent(
        idCounter++,
        env,
        env.getCollisionShapes().getQuick(0),
        new Vector3f (5,3,0),
        null,
        0.1f);
   
    ConstraintDemoAgent gewichtAgent = new ConstraintDemoAgent(
        idCounter++,
        env,
        env.getCollisionShapes().getQuick(1),
        new Vector3f (0,10,0),
        null,
        5f);
   
   
    // (RigidBody rbA, RigidBody rbB,
    // Vector3f pivotInA, Vector3f pivotInB,
    // Vector3f axisInA, Vector3f axisInB)
    HingeConstraint gelenk1 = new HingeConstraint(
        groundAgent.getRigidBody(),
        armAgent1.getRigidBody(),
        new Vector3f (0,1,0),
        new Vector3f (5,-.5f,0),
        new Vector3f (0,0,1),
        new Vector3f (0,0,1));
   
    gelenk1.setLimit((float) Math.toRadians(20), (float) Math.toRadians(80));
   
   
    HingeConstraint gelenk2 = new HingeConstraint(
        armAgent1.getRigidBody(),
        armAgent2.getRigidBody(),
        new Vector3f (-5,0.55f,0),
        new Vector3f (-5,-0.55f,0),
        new Vector3f (0,0,1),
        new Vector3f (0,0,1));
   
    gelenk2.setLimit((float) Math.toRadians(-140), (float) Math.toRadians(-50));
       
    Point2PointConstraint gewichtBefestigung = new Point2PointConstraint(
        armAgent2.getRigidBody(),
        gewichtAgent.getRigidBody(),
        new Vector3f (5,0,0),
        new Vector3f (0,0,0));
     
   
    Transform localA = new Transform();
    localA.setIdentity();
    Transform localB = new Transform();
    localB.setIdentity();
   
    localA.origin.set(new Vector3f (0,0,0));
    localB.origin.set(new Vector3f (0,0,0));
    Generic6DofConstraint senkrecht = new Generic6DofConstraint(
        groundAgent.getRigidBody(),
        gewichtAgent.getRigidBody(),
        localA,
        localB,
        true);
   
    senkrecht.setLimit(0, -.9f, .9f);
    senkrecht.setLimit(1, 7, 100);
    senkrecht.setLimit(2, -.9f, .9f);

    env.getDynamicsWorld().addConstraint(gelenk1, true);
    env.getDynamicsWorld().addConstraint(gelenk2, true);
    env.getDynamicsWorld().addConstraint(gewichtBefestigung, true);
    env.getDynamicsWorld().addConstraint(senkrecht, true);
   
    env.addAgent(groundAgent);
    env.addAgent(armAgent1);
    env.addAgent(armAgent2);
    env.addAgent(gewichtAgent);
   
   
   
   
    ///////////////////////////////////////
    ////////////PENDEL
    ///////////////////////////////////////
    BoxShape pendelShape = new BoxShape (new Vector3f (.5f,10,.5f));
    env.getCollisionShapes().add(pendelShape);
   
    ConstraintDemoAgent pendelAgent = new ConstraintDemoAgent(
        idCounter++,
        env,
View Full Code Here

  @Override
  public DemoEnvironment3D1[] generateRunnables(ParCollection params) {
   
    DemoEnvironment3D1 env = new DemoEnvironment3D1 (0, params);   
   
    CollisionShape box1 = new BoxShape(new Vector3f(1f,1f,1f));
    CollisionShape box2 = new BoxShape(new Vector3f (50f, 50f, 50f));
   
    env.getCollisionShapes().add(box1);
    env.getCollisionShapes().add(box2);
   
   
View Full Code Here

    int idCounter = 0;
   
    DemoEnvironment3Dv5 env = new DemoEnvironment3Dv5(0, params);
   
    // Die CollisionShapes erzeugen. Sollten mehrmals verwendet werden!
    BoxShape endShape = new BoxShape(new Vector3f(1f, 2f, 2f));
    BoxShape middleShape = new BoxShape(new Vector3f(1f,1f,1f));
    SphereShape ballShape = new SphereShape(1f);
   
    // Die CollisionShapes der Collection hinzufügen, damit die Referenzen
    // immer erhalten bleiben und die Shapes mehrmals verwendet werden können.
    env.getCollisionShapes().add(endShape);
View Full Code Here

 
  @Override
    public DemoEnvironment3Dv3[] generateRunnables(ParCollection params) {
    DemoEnvironment3Dv3 env = new DemoEnvironment3Dv3(0, params);
   
    CollisionShape ground = new BoxShape(new Vector3f (100f, 1f, 100f));
    CollisionShape sphere = new SphereShape(1f);
    CollisionShape bigSphere = new SphereShape(5f);
   
    env.getCollisionShapes().add(ground);
    env.getCollisionShapes().add(sphere);
View Full Code Here

    boolean chessSurface = params.getParValueBoolean("chessSurface");
   
    // Very large box as ground.
    if (!chessSurface) {
      System.out.println("Simple ground - no chess surface.");
      BoxShape groundShape = new BoxShape(new Vector3f(10000, 10, 10000));

      // Create transform to store ground's location.
      Transform transform = new Transform();
      transform.setIdentity();
      transform.origin.set(new Vector3f(0, -10, 0));

      // Create new MotionState to keep track of object.
      DefaultMotionState motionState = new DefaultMotionState(transform);
      Vector3f localInertia = new Vector3f(0, 0, 0);
      RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(0,
          motionState, groundShape, localInertia);

      // Create the rigid body and add it to the dynamicsworld.
      RigidBody body = new RigidBody(rbInfo);
      getDynamicsWorld().addRigidBody(body);

      // Set friction.
      //body.setFriction(1);

      // Store locally.
      this.ground = body;

    }

    else {
      System.out.println("Using chess surface ground");
      BoxShape bShape = new BoxShape(new Vector3f(20, 10, 20));

      for (int i = 0; i < 20; i++) {
        for (int j = 0; j < 21; j++) {
          // Create transform to store ground's location.
          Transform transform = new Transform();
View Full Code Here

      float mass) {
    super(id, env, null);
   
    //set collisionShape to standard if necessary.   
    if (collisionShape == null){
      collisionShape = new BoxShape (new Vector3f(1f,1f,1f));
    }
   
    this.collisionShape = collisionShape;
   
    this.mass = mass;
View Full Code Here

   * @param mass
   */
  public GroundAgent(int id, AbstractEnvironment3D<?> env) {
    super(id,
        env,
        new BoxShape (new Vector3f (100, 1, 100)),
        new Vector3f (0,-2,0),
        null,
        0);
  }
View Full Code Here

    @Override
    public Env3D[] generateRunnables(ParCollection params) {

        Env3D env = new Env3D(0, params);

        CollisionShape box2 = new BoxShape(new Vector3f(100f, 10f, 100f));
        env.getCollisionShapes().add(box2);
        CollisionShape box3 = new BoxShape(new Vector3f(30f, 30f, 5f));
        env.getCollisionShapes().add(box2);
        CollisionShape box4 = new BoxShape(new Vector3f(30f, 30f, 5f));
        env.getCollisionShapes().add(box2);
        CollisionShape box5 = new BoxShape(new Vector3f(5f, 30f, 30f));
        env.getCollisionShapes().add(box2);
        CollisionShape box6 = new BoxShape(new Vector3f(5f, 30f, 30f));
        env.getCollisionShapes().add(box2);
        env.addAgent(new Agent3D(0, env, box2, new Vector3f(0f, -51f, 0f), 0f));
        env.addAgent(new Agent3D(1, env, box3, new Vector3f(0f, 0f, 45f), 0f));
        env.addAgent(new Agent3D(2, env, box4, new Vector3f(0f, 0f, -45f), 0f));
        env.addAgent(new Agent3D(3, env, box5, new Vector3f(45f, 0f, 0f), 0f));
View Full Code Here

TOP

Related Classes of com.bulletphysics.collision.shapes.BoxShape

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.