Package com.bulletphysics.dynamics.constraintsolver

Examples of com.bulletphysics.dynamics.constraintsolver.Point2PointConstraint


                .getCenterOfMassTransform(new Transform());
            tmpTrans.inverse();
            Vector3f localPivot = new Vector3f(pickPos);
            tmpTrans.transform(localPivot);

            Point2PointConstraint p2p = new Point2PointConstraint(
                body, localPivot);
            myWorld.addConstraint(p2p);
            pickConstraint = p2p;
            // save mouse position for dragging
            BulletStats.gOldPickingPos.set(rayTo);
View Full Code Here


    x = (int) this.scaleVal(x);
    y = (int) this.scaleVal(y);
    if (pickConstraint != null) {
      // move the constraint pivot
      Point2PointConstraint p2p = (Point2PointConstraint) pickConstraint;
      if (p2p != null) {
        // keep it at the same picking distance

        //Vector3f newRayTo = new Vector3f(getRayToCustom(x, y));
        //Vector3f eyePos = new Vector3f(cameraPosition);
        //Vector3f dir = new Vector3f();
        //dir.sub(newRayTo, eyePos);
        //dir.normalize();
        //dir.scale(BulletStats.gOldPickingDist);

        Vector3f newPos = new Vector3f(x, y, this.pickDist);
        //newPos.add(eyePos, dir);
        p2p.setPivotB(newPos);
      }
    }

  }
View Full Code Here

        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,
        env.getCollisionShapes().getQuick(2),
        new Vector3f (10,25,10),
        null,
        .5f);
   
    ConstraintDemoAgent pendelKugelAgent = new ConstraintDemoAgent(
        idCounter++,
        env,
        env.getCollisionShapes().getQuick(1),
        new Vector3f (10,5,10),
        null,
        5f);
   
    Point2PointConstraint pendelAufhaengung = new Point2PointConstraint(
        pendelAgent.getRigidBody(),
        new Vector3f (0,11,0));
   
    Point2PointConstraint pendelKugelBefestigung = new Point2PointConstraint(
        pendelAgent.getRigidBody(),
        pendelKugelAgent.getRigidBody(),
        new Vector3f (0,-10,0),
        new Vector3f (0,0,0));
   
View Full Code Here

                  Transform tmpTrans = body.getCenterOfMassTransform(new Transform());
                  tmpTrans.inverse();
                  Vector3f localPivot = new Vector3f(pickPos);
                  tmpTrans.transform(localPivot);

                  Point2PointConstraint p2p = new Point2PointConstraint(body, localPivot);
                  p2p.setting.impulseClamp = mousePickClamping;

                  dynamicsWorld.addConstraint(p2p);
                  pickConstraint = p2p;
                  // save mouse position for dragging
View Full Code Here

  }
 
  public void mouseMotionFunc(int x, int y) {
    if (pickConstraint != null) {
      // move the constraint pivot
      Point2PointConstraint p2p = (Point2PointConstraint) pickConstraint;
      if (p2p != null) {
        // keep it at the same picking distance

        Vector3f newRayTo = new Vector3f(getRayTo(x, y));
        Vector3f eyePos = new Vector3f(cameraPosition);
        Vector3f dir = new Vector3f();
        dir.sub(newRayTo, eyePos);
        dir.normalize();
        dir.scale(BulletStats.gOldPickingDist);

        Vector3f newPos = new Vector3f();
        newPos.add(eyePos, dir);
        p2p.setPivotB(newPos);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.bulletphysics.dynamics.constraintsolver.Point2PointConstraint

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.