org.odejava.test.simple
Class LowLevelApiExample

java.lang.Object
  extended by org.odejava.test.simple.LowLevelApiExample

public class LowLevelApiExample
extends Object

Creates simple Odejava simulation. Consists of a static plane (ground), box and sphere object. Box and sphere are placed in the air above the ground, as the simulation goes ahead they fall to ground and collide to each other. Coordinate is selected in such way that Z is up. Note, this example uses low level API. Consider using high level API and extend it with low level API as needed. see http://odejava.dev.java.net

Author:
Jani Laakso E-mail: jani.laakso@itmill.com

Constructor Summary
LowLevelApiExample()
          Create world and objects.
 
Method Summary
 void cleanup()
          Clean up native ODE objects.
 org.openmali.vecmath2.Vector3f getBodyPosition(org.odejava.ode.SWIGTYPE_p_dBodyID body)
          Helper method for converting internal ODE array into Java object
 org.openmali.vecmath2.Quaternion4f getBodyQuaternion(org.odejava.ode.SWIGTYPE_p_dBodyID body)
          Helper method for converting internal ODE array into Java object
static void main(String[] args)
          Standalone test application that prints simulation results to console.
 void simulate(int steps)
          Simulate Odejava environment and objects by stepping the world ahead.
 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

LowLevelApiExample

public LowLevelApiExample()
Create world and objects. Note, this example uses low level API. Consider using high level API and extend it with low level API as needed.

Method Detail

main

public static void main(String[] args)
Standalone test application that prints simulation results to console.


simulate

public void simulate(int steps)
Simulate Odejava environment and objects by stepping the world ahead.

Parameters:
steps - to simulate

step

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


getBodyPosition

public org.openmali.vecmath2.Vector3f getBodyPosition(org.odejava.ode.SWIGTYPE_p_dBodyID body)
Helper method for converting internal ODE array into Java object

Returns:
Returns the bodyPos.

getBodyQuaternion

public org.openmali.vecmath2.Quaternion4f getBodyQuaternion(org.odejava.ode.SWIGTYPE_p_dBodyID body)
Helper method for converting internal ODE array into Java object

Returns:
Returns the body orientation using quatertion.

cleanup

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