Package eas.users.students.fabian.rocket

Source Code of eas.users.students.fabian.rocket.PassiveAgent

/*
* File name:        RocketAgent.java (package eas.users.fabian.rocket)
* Author(s):        Fabian
* Java version:     6.0
* Generation date:  01.02.2012 (14:12:26)
*
* (c) This file and the EAS (Easy Agent Simulation) framework containing it
* is protected by Creative Commons by-nc-sa license. Any altered or
* further developed versions of this file have to meet the agreements
* stated by the license conditions.
*
* In a nutshell
* -------------
* You are free:
* - to Share -- to copy, distribute and transmit the work
* - to Remix -- to adapt the work
*
* Under the following conditions:
* - Attribution -- You must attribute the work in the manner specified by the
*   author or licensor (but not in any way that suggests that they endorse
*   you or your use of the work).
* - Noncommercial -- You may not use this work for commercial purposes.
* - Share Alike -- If you alter, transform, or build upon this work, you may
*   distribute the resulting work only under the same or a similar license to
*   this one.
*
* + Detailed license conditions (Germany):
*   http://creativecommons.org/licenses/by-nc-sa/3.0/de/
* + Detailed license conditions (unported):
*   http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en
*
* This header must be placed in the beginning of any version of this file.
*/

package eas.users.students.fabian.rocket;

import org.ode4j.ode.DBody;
import org.ode4j.ode.DGeom;
import org.ode4j.ode.DMass;
import org.ode4j.ode.OdeHelper;

import eas.math.geometry.Vector3D;
import eas.plugins.standard.visualization.visualization3D.VideoPluginLWJGL.DS_TEXTURE_NUMBER;
import eas.simulation.spatial.sim3D.physicalSimulation.standardAgents.AbstractAgentODE3D;
import eas.simulation.spatial.sim3D.physicalSimulation.standardEnvironments.AbstractEnvironmentODE3D;
import eas.startSetup.ParCollection;

/**
* @author Fabian
*
*/
public class PassiveAgent extends AbstractAgentODE3D<AbstractEnvironmentODE3D<?>> {

  /**
     *
     */
    private static final long serialVersionUID = 270258558790828413L;


    public PassiveAgent(int id,
      AbstractEnvironmentODE3D<AbstractAgentODE3D<?>> env,
      ParCollection params,
      Vector3D pos) {
    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);
    body.setAngularDamping(.001f);
    body.setLinearDamping(.001f);
    bodies.add(body);
    geoms.add(geom);
    masses.add(mass);
//    masses[0] = OdeHelper.createMass();
//    bodies[0] = OdeHelper.createBody(env.getWorld());
//    masses[0].setBox(1, 1, 1, 3);
//    bodies[0].setMass(masses[0]);
//    bodies[0].setPosition(0, 0, 3);
//    geoms[0] = OdeHelper.createBox(1, 1, 3);
//    geoms[0].setBody(bodies[0]);
//    env.getSpace().add(geoms[0]);
//    bodies[0].setLinearDamping(.001f);
//    bodies[0].setAngularDamping(.001f);
  }

  /* (non-Javadoc)
   * @see eas.simulation.spatial.sim3D.physicalSimulation.standardAgents.AbstractAgentODE3D#isDrawableInODE()
   */
  @Override
  public boolean isDrawableInLWJGL() {
    // TODO Auto-generated method stub
    return true;
  }
 

  @Override
  public void drawInLWJGL(){
    setTexture(DS_TEXTURE_NUMBER.DS_NONE);
    float[] color = new float[] {.5f,.5f,.5f};
    setColor(color );
    super.drawInLWJGL();
  }
}
TOP

Related Classes of eas.users.students.fabian.rocket.PassiveAgent

TOP
Copyright © 2018 www.massapi.com. 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.