org.odejava.test.car
Class CarTerrain

java.lang.Object
  extended by org.odejava.test.car.CarTerrain

public class CarTerrain
extends Object

Creates Open Dynamics Engine world. Plug this demonstration class into any 3d rendered (Xith3d, Openmind, jME, Java3D).

Author:
Jani Laakso E-mail: jani.laakso@itmill.com
See Also:
the ODE documentation

Constructor Summary
CarTerrain()
          Create world and objects.
 
Method Summary
 void accelerate(float force)
          Accelerate (or deaccelerate).
 void applyForceToCar(float z)
          Test ODE's addForce method to car chassis.
 void cleanup()
          Clean up native ODE objects.
 void createTriMesh(String name, float[] vertex, int[] index)
           
 List<Body> getBodies()
           
 Body getBody(String name)
           
 int getBoxCount()
           
 Geom getGeom(String name)
           
 List<Geom> getGeoms()
           
 org.openmali.vecmath2.Vector3f getGravity()
           
 int getSphereCount()
           
 boolean isHandbrake()
           
 void rotateObjects(float x, float y, float z)
          Test ODE's addForce method to all objects.
 void setGravity(org.openmali.vecmath2.Vector3f gravity)
           
 void setHandbrake(boolean handbrake)
           
 void setSimulation()
          Set an sample simulation.
 void steer(float steer)
          Steer car's front wheels.
 void step()
          Step simulation ahead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CarTerrain

public CarTerrain()
Create world and objects.

Method Detail

createTriMesh

public void createTriMesh(String name,
                          float[] vertex,
                          int[] index)

setSimulation

public void setSimulation()
Set an sample simulation. Also resets existing simulation.


step

public void step()
Step simulation ahead. Call this step once before rendering results into the screen.


getGravity

public org.openmali.vecmath2.Vector3f getGravity()
Returns:
Returns the gravity.

setGravity

public void setGravity(org.openmali.vecmath2.Vector3f gravity)
Parameters:
gravity - The gravity to set.

accelerate

public void accelerate(float force)
Accelerate (or deaccelerate).

Parameters:
force -

steer

public void steer(float steer)
Steer car's front wheels.

Parameters:
steer -

rotateObjects

public void rotateObjects(float x,
                          float y,
                          float z)
Test ODE's addForce method to all objects.

Parameters:
x -
y -
z -

applyForceToCar

public void applyForceToCar(float z)
Test ODE's addForce method to car chassis.

Parameters:
z -

cleanup

public void cleanup()
Clean up native ODE objects. Call this before ending your Java program.


isHandbrake

public boolean isHandbrake()
Returns:
Returns the handbrake.

setHandbrake

public void setHandbrake(boolean handbrake)
Parameters:
handbrake - The handbrake to set.

getBodies

public List<Body> getBodies()

getBody

public Body getBody(String name)

getGeoms

public List<Geom> getGeoms()

getGeom

public Geom getGeom(String name)

getBoxCount

public int getBoxCount()
Returns:
Returns the boxCount.

getSphereCount

public int getSphereCount()
Returns:
Returns the sphereCount.