Package org.ode4j.ode

Examples of org.ode4j.ode.DMass


    super(id, env, params);
//    bodies = new DBody[1];
//    geoms = new DGeom[1];
//    masses = new DMass[1];
   
    DMass mass = OdeHelper.createMass();
    DBody body = OdeHelper.createBody(env.getWorld());
    mass.setBox(1, 1, 1, 3);
    body.setMass(mass);
    body.setPosition(pos.x, pos.y, pos.z);
    DGeom geom = OdeHelper.createBox(0.5, 0.5, 3);
    geom.setBody(body);
    env.getSpace().add(geom);
View Full Code Here


    super(id, env, params);
//    bodies = new DBody[1];
//    geoms = new DGeom[1];
//    masses = new DMass[1];
   
    DMass mass = OdeHelper.createMass();
    DBody body = OdeHelper.createBody(env.getWorld());
    mass.setBox(1, 1, 1, 3);
    body.setMass(mass);
    body.setPosition(pos.x, pos.y, pos.z);
    DGeom geom = OdeHelper.createBox(1, 1, 1);
    geom.setBody(body);
    env.getSpace().add(geom);
View Full Code Here

  private float[] color = new float[] {(float)Math.random(), (float)Math.random(), (float)Math.random()};
 
  public PuckAgent(int id, AbstractEnvironmentODE3D<?> env,
      ParCollection params, DVector3 position) {
    super(id, env, params);
    DMass mass = OdeHelper.createMass();
    DBody body = OdeHelper.createBody(env.getWorld());
    body.setPosition(position);
//    DVector3 size = new DVector3(1,1,1);
//    mass.setBox(1, size.get0(), size.get1(), size.get2());
    mass.setCylinder(1, 1, 1, .5);
    body.setMass(mass);
//    geom = OdeHelper.createBox(size.get0(), size.get1(), size.get2());
    DGeom geom = OdeHelper.createCylinder(null, 1, .5);
    geom.setBody(body);
    env.getSpace().add(geom);
View Full Code Here

      for (int y = 0; y < height; y++) {
        bodyMatrix[x][y] = OdeHelper.createBody(env.getWorld());
        bodyMatrix[x][y].setPosition(initialPos.get0() - (x+1) * distance
            + offset, initialPos.get1() - (y+1) * distance + offset,
            initialPos.get2());
        DMass mass = OdeHelper.createMass();
        mass.setSphereTotal(0.000001, radius);
        bodyMatrix[x][y].setMass(mass);
        bodies.add(bodyMatrix[x][y]);
        geomMatrix[x][y] = OdeHelper.createSphere(env.getSpace(),
            radius);
        geoms.add(geomMatrix[x][y]);
View Full Code Here

    // initialize necessary variables
    this.numberOfModules = numberOfModules;
    servoRefPos = new double[numberOfModules];
//    masses = new DMass[1];
    DMass mass = OdeHelper.createMass();
    masses.add(mass);
//    bodies = new DBody[numberOfModules + 1];
//    geoms = new DGeom[numberOfModules * 2];
    joints = new DHingeJoint[numberOfModules];

    // create bodies and geoms for the modules
    {
      // create left body
      DBody body = OdeHelper.createBody(env.getWorld());
      body.setPosition(0, -L / 4, H / 2);
      mass.setBoxTotal(MASS / 2, W, L / 2, H);
      body.setMass(mass);
      DGeom geom = OdeHelper.createBox(env.getSpace(), W, L / 2, H);
      geom.setBody(body);
      bodies.add(body);
      geoms.add(geom);

      // create central bodies
      for (int i = 1; i < numberOfModules; i++) {
        body = OdeHelper.createBody(env.getWorld());
        body.setPosition(0, -L * (i), H / 2);
        mass.setBoxTotal(MASS, W, L / 2, H);
        body.setMass(mass);

        geom = OdeHelper.createBox(env.getSpace(), W, L / 2, H);
        DGeom geom2 = OdeHelper.createBox(
            env.getSpace(), W, L / 2, H);

        geom.setBody(body);
        geom2.setBody(body);

        geom.setOffsetPosition(0, L / 4, 0);
        geom2.setOffsetPosition(0, -L / 4, 0);
        bodies.add(body);
        geoms.add(geom);
        geoms.add(geom2);
      }

      // create right body
      body = OdeHelper.createBody(env.getWorld());
      body.setPosition(0,
          (-(numberOfModules) * L + L / 4), H / 2);
      mass.setBoxTotal(MASS / 2, W, L / 2, H);
      body.setMass(mass);
      geom = OdeHelper.createBox(
          env.getSpace(), W, L / 2, H);
      geom.setBody(body);
      bodies.add(body);
View Full Code Here

 
  public BumperAgent(int id, AbstractEnvironmentODE3D<?> env,
      ParCollection params, DVector3 position) {
    super(id, env, params);
   
    DMass mass = OdeHelper.createMass();
    DBody body = OdeHelper.createBody(env.getWorld());
    body.setPosition(position);
    DVector3 size = new DVector3(1,1,1);
    mass.setBox(1, size.get0(), size.get1(), size.get2());
    body.setMass(mass);
    DGeom geom = OdeHelper.createBox(size.get0(), size.get1(), size.get2());
    geom.setBody(body);
    env.getSpace().add(geom);
   
View Full Code Here

        bodyMatrix[x][y] = OdeHelper.createBody(env.getWorld());
        bodies.add(bodyMatrix[x][y]);
        bodyMatrix[x][y].setPosition(initialPos.get0()+x*distance,
            initialPos.get1() + y * distance,
            initialPos.get2());
        DMass mass = OdeHelper.createMass();
        mass.setSphereTotal(sphereMass, radius);
        masses.add(mass);
        bodyMatrix[x][y].setMass(mass);
        geomMatrix[x][y] = OdeHelper.createSphere(env.getSpace(),
            radius);
        geoms.add(geomMatrix[x][y]);
View Full Code Here

    public ClothEnv(int id, ParCollection params) {
    super(id, params);
    DBody blockbody = OdeHelper.createBody(getWorld());
    DGeom blockgeom = OdeHelper.createSphere(1);
    DMass blockmass = OdeHelper.createMass();
    blockbody.setPosition(0, 0, 1.1);
    blockmass.setSphere(1, 1);
    blockgeom.setBody(blockbody);
    blockbody.setMass(blockmass);
    getSpace().add(blockgeom);
   
  }
View Full Code Here

    super(id, env, params);
   
    DGeom geom = OdeHelper.createSphere(env.getSpace(), 1);
    DBody body = OdeHelper.createBody(env.getWorld());
    body.setPosition(0, 0, 1);
    DMass mass = OdeHelper.createMass();
    mass.setSphere(2, 2);
    geom.setBody(body);
    body.setKinematic();
   
    bodies.add(body);
    geoms.add(geom);
View Full Code Here

      for (int y = 0; y < height; y++) {
        bodyMatrix[x][y] = OdeHelper.createBody(env.getWorld());
        bodyMatrix[x][y].setPosition(initialPos.get0() - (x+1) * distance
            + offset, initialPos.get1() - (y+1) * distance + offset,
            initialPos.get2());
        DMass mass = OdeHelper.createMass();
        mass.setSphereTotal(0.000001, radius);
        bodyMatrix[x][y].setMass(mass);
        bodies.add(bodyMatrix[x][y]);
        geomMatrix[x][y] = OdeHelper.createSphere(env.getSpace(),
            radius);
        geoms.add(geomMatrix[x][y]);
View Full Code Here

TOP

Related Classes of org.ode4j.ode.DMass

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.