Package eas.users.students.fabian.curling

Source Code of eas.users.students.fabian.curling.PuckAgent

/*
* File name:        ODEPrimitiveAgent.java (package eas.users.fabian.odeVersuche)
* Author(s):        Fabian
* Java version:     6.0
* Generation date:  26.01.2012 (16:28:51)
*
* (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.curling;

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

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 PuckAgent extends AbstractAgentODE3D<AbstractEnvironmentODE3D<?>>{
  /**
     *
     */
    private static final long serialVersionUID = 5142084279051651925L;
    /**
   * @param id
   * @param env
   * @param params
   */
  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);
   
    bodies.add(body);
    geoms.add(geom);
    masses.add(mass);
  }
 
  @Override
  public void drawInLWJGL(){
    setTexture(DS_TEXTURE_NUMBER.DS_WOOD);
    setColor(color);
    super.drawInLWJGL();
  }
 
  @Override
  public boolean isDrawableInLWJGL() {
    return true;
  }
 
  @Override
  public DVector3 getPosition() {
    DVector3 vec = null;
    return vec;
  }
}
TOP

Related Classes of eas.users.students.fabian.curling.PuckAgent

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.