/*
* File name: ObstacleAgent.java (package eas.users.fabian.cloth)
* Author(s): Fabian
* Java version: 6.0
* Generation date: 20.02.2012 (13:50:55)
*
* (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.cloth;
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;
import eas.simulation.spatial.sim3D.physicalSimulation.standardAgents.AbstractAgentODE3D;
import eas.startSetup.ParCollection;
/**
* @author Fabian
*
*/
public class ObstacleAgent extends AbstractAgentODE3D<ClothEnv> {
/**
*
*/
private static final long serialVersionUID = -933312160347466451L;
/**
* @param id
* @param env
* @param params
*/
public ObstacleAgent(int id, ClothEnv env, ParCollection params) {
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);
masses.add(mass);
}
@Override
public boolean isDrawableInLWJGL() {
return true;
}
@Override
public void drawInLWJGL() {
VideoPluginLWJGL.dsSetColor(0, 1, 1);
super.drawInLWJGL();
}
}