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));
pendelKugelAgent.getRigidBody().setActivationState(CollisionObject.DISABLE_DEACTIVATION);
pendelAgent.getRigidBody().setActivationState(CollisionObject.DISABLE_DEACTIVATION);
env.addAgent(pendelAgent);
env.addAgent(pendelKugelAgent);
env.getDynamicsWorld().addConstraint(pendelAufhaengung, true);
env.getDynamicsWorld().addConstraint(pendelKugelBefestigung, true);
//////////////////////////////////
////////////// DOPSBALL
//////////////////////////////////
ConstraintDemoAgent dopsBall = new ConstraintDemoAgent(
idCounter++,
env,
env.getCollisionShapes().getQuick(1),
new Vector3f (-20,40,20),
null,
1);
dopsBall.getRigidBody().setActivationState(CollisionObject.DISABLE_DEACTIVATION);
dopsBall.getRigidBody().setRestitution(.8f);
groundAgent.getRigidBody().setRestitution(.8f);
localA.setIdentity();
localB.setIdentity();
localA.origin.set (new Vector3f (-20,0,20));
localB.origin.set (new Vector3f (0,0,0));
Generic6DofConstraint dopsBallConstraint = new Generic6DofConstraint(
groundAgent.getRigidBody(),
dopsBall.getRigidBody(),
localA,
localB,
true);
dopsBallConstraint.setLimit(1, 1, 100);
env.addAgent(dopsBall);
env.getDynamicsWorld().addConstraint(dopsBallConstraint, false);
////////////////////////////////////
///// SCHWEBENDER BALL
////////////////////////////////
ConstraintDemoAgent schwebenderBallAgent = new ConstraintDemoAgent(
idCounter++,
env,
env.getCollisionShapes().getQuick(1),
new Vector3f (0,10,30),
null,
1);
schwebenderBallAgent.getRigidBody().setActivationState(CollisionObject.DISABLE_DEACTIVATION);
schwebenderBallAgent.getRigidBody().setRestitution(1);
schwebenderBallAgent.getRigidBody().setFriction(0);
schwebenderBallAgent.getRigidBody().setGravity(new Vector3f(0,0,0));
localA.setIdentity();
localB.setIdentity();
localA.origin.set(new Vector3f (0,10,30));
localB.origin.set(new Vector3f (0,0,0));
Generic6DofConstraint schwebenderBallAgentConstraint = new Generic6DofConstraint(
groundAgent.getRigidBody(),