Package com.bulletphysics.collision.shapes

Examples of com.bulletphysics.collision.shapes.StaticPlaneShape


        CollisionConfiguration collisionConfiguration = new DefaultCollisionConfiguration();
        CollisionDispatcher dispatcher = new CollisionDispatcher(collisionConfiguration);
        ConstraintSolver solver = new SequentialImpulseConstraintSolver();
        dynamicsWorld = new DiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
        dynamicsWorld.setGravity(new Vector3f(0, -10 /* m/s2 */, 0));
        CollisionShape groundShape = new StaticPlaneShape(new Vector3f(0, 1, 0), 0.25f /* m */);
        CollisionShape ballShape = new SphereShape(3.0f);
        MotionState groundMotionState = new DefaultMotionState(new Transform(new Matrix4f(
                new Quat4f(0, 0, 0, 1),
                new Vector3f(0, 0, 0), 1.0f)));
        RigidBodyConstructionInfo groundBodyConstructionInfo = new RigidBodyConstructionInfo(0, groundMotionState, groundShape, new Vector3f(0, 0, 0));
View Full Code Here


        // zero.
        dynamicsWorld.setGravity(new Vector3f(0, -10, 0));
        // Initialise 'groundShape' to a static plane shape on the origin facing upwards ([0, 1, 0] is the normal).
        // 0.25 metres is an added buffer between the ground and potential colliding bodies, used to prevent the bodies
        // from partially going through the floor. It is also possible to think of this as the plane being lifted 0.25m.
        CollisionShape groundShape = new StaticPlaneShape(new Vector3f(0, 1, 0), 0.25f);
        // Initialise 'ballShape' to a sphere with a radius of 3 metres.
        CollisionShape ballShape = new SphereShape(3);
        // Initialise 'groundMotionState' to a motion state that simply assigns the origin [0, 0, 0] as the origin of
        // the ground.
        MotionState groundMotionState = new DefaultMotionState(new Transform(new Matrix4f(new Quat4f(0, 0, 0, 1), new Vector3f(0, 0, 0), 1.0f)));
View Full Code Here

    myWorld.setGravity(new Vector3f(0f, 3, 0f));

    // create a few basic rigid bodies
    // CollisionShape groundShape = new BoxShape(new Vector3f(50f, 50f,
    // 50f));
    CollisionShape groundShape = new StaticPlaneShape(
        new Vector3f(0, -1, 0), 1);

    collisionShapes.add(groundShape);

    Transform groundTransform = new Transform();
    groundTransform.setIdentity();
    groundTransform.origin.set(this.scaleVal(600), this.scaleVal(1600),
        this.scaleVal(600));

    CollisionShape constrainPlane = new StaticPlaneShape(new Vector3f(0, 0,
        1), 1);

    Vector3f localInertia2 = new Vector3f(0, 0, 0);
    Transform planeTransform = new Transform();
    planeTransform.setIdentity();
View Full Code Here

    //#ifdef GIMPACT_VS_PLANE_COLLISION
    if (shape0.getGImpactShapeType() == ShapeType.TRIMESH_SHAPE_PART &&
        shape1.getShapeType() == BroadphaseNativeType.STATIC_PLANE_PROXYTYPE) {
      GImpactMeshShapePart shapepart = (GImpactMeshShapePart) shape0;
      StaticPlaneShape planeshape = (StaticPlaneShape) shape1;
      gimpacttrimeshpart_vs_plane_collision(body0, body1, shapepart, planeshape, swapped);
      return;
    }
    //#endif
View Full Code Here

 
  protected void gimpacttrimeshpart_vs_plane_collision(CollisionObject body0, CollisionObject body1, GImpactMeshShapePart shape0, StaticPlaneShape shape1, boolean swapped) {
    Transform orgtrans0 = body0.getWorldTransform(Stack.alloc(Transform.class));
    Transform orgtrans1 = body1.getWorldTransform(Stack.alloc(Transform.class));

    StaticPlaneShape planeshape = shape1;
    Vector4f plane = Stack.alloc(Vector4f.class);
    PlaneShape.get_plane_equation_transformed(planeshape, orgtrans1, plane);

    // test box against plane

    AABB tribox = Stack.alloc(AABB.class);
    shape0.getAabb(orgtrans0, tribox.min, tribox.max);
    tribox.increment_margin(planeshape.getMargin());

    if (tribox.plane_classify(plane) != PlaneIntersectionType.COLLIDE_PLANE) {
      return;
    }
    shape0.lockChildShapes();

    float margin = shape0.getMargin() + planeshape.getMargin();

    Vector3f vertex = Stack.alloc(Vector3f.class);

    Vector3f tmp = Stack.alloc(Vector3f.class);
View Full Code Here

    //staticBody.setCollisionFlags(staticBody.getCollisionFlags() | CollisionFlags.CUSTOM_MATERIAL_CALLBACK);

    // static plane
    Vector3f normal = new Vector3f(0.4f, 1.5f, -0.4f);
    normal.normalize();
    CollisionShape staticplaneShape6 = new StaticPlaneShape(normal, 0f); // A plane

    startTransform.origin.set(0f, 0f, 0f);

    RigidBody staticBody2 = localCreateRigidBody(mass, startTransform, staticplaneShape6);
View Full Code Here

//
//          }

          case STATIC_PLANE_PROXYTYPE:
          {
            StaticPlaneShape staticPlaneShape = (StaticPlaneShape)shape;
            float planeConst = staticPlaneShape.getPlaneConstant();
            Vector3f planeNormal = staticPlaneShape.getPlaneNormal(vectorsPool.get());
            Vector3f planeOrigin = vectorsPool.get();
            planeOrigin.scale(planeConst, planeNormal);
            Vector3f vec0 = vectorsPool.get();
            Vector3f vec1 = vectorsPool.get();
            TransformUtil.planeSpace1(planeNormal,vec0,vec1);
View Full Code Here

    CollisionObject convexObj = isSwapped ? body1 : body0;
    CollisionObject planeObj = isSwapped ? body0 : body1;

    ConvexShape convexShape = (ConvexShape) convexObj.getCollisionShape();
    StaticPlaneShape planeShape = (StaticPlaneShape) planeObj.getCollisionShape();

    boolean hasCollision = false;
    Vector3f planeNormal = planeShape.getPlaneNormal(Stack.alloc(Vector3f.class));
    float planeConstant = planeShape.getPlaneConstant();

    Transform planeInConvex = Stack.alloc(Transform.class);
    convexObj.getWorldTransform(planeInConvex);
    planeInConvex.inverse();
    planeInConvex.mul(planeObj.getWorldTransform(tmpTrans));
View Full Code Here

TOP

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

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.