Mathematical Visualization WS08 Technical University Berlin
Theme: Physics Engine
Part 1. The Example
- Begin by updating your eclipse state, starting with jreality and then with our MathVisWS08 project.
- Next, go to the "SVN Repository Browsing" perspective and check out the jrealityBullet project:
- On the right mouse context menu, choose "New repository location..."
- Enter the name
http://fs.math.tu-berlin.de:8000/svn/jrealityBullet and click "OK"
- If you are prompted for your name and password enter the same one you entered for our class svn repository.
- Once the repository shows up, open it and select the "Trunk" entry, and then use right mouse context menu and choose "Checkout ...".
- In the new project wizard you can use the defaults.
- If you already have the packages de.jreality.audio.jass, de.jreality.bullet, and de.jreality.bullet.sound in the MathVisWS08 project, delete them. They are no longer needed.
- Return to the package
de.jreality.mathvisws08. You should see this new class:
- Sample03PhysicsEngine This is the main class for this week's assignment.
- Find out more about jBullet.
- Download the source from the jBullet site and put it into its own eclipse project if you want to study it.
- Run the Sample03PhysicsEngine as a Java application. Follow the instructions on the "ReadMe" tab.
- To see another example of jBullet in jReality, run the class de.jreality.bullet.PhysicsViewerVR.
- You must first load a shape using the "Load" tab of the inspector window (this window may show up behind the graphics window).
- Then you can basically do the same operations as in the Sample03PhysicsEngine
- Additionally you can set more physics parameters on the "Physics" tab of the inspector window.
- To see an example of the jBullet joint object in jReality, run the class de.jreality.mathvisws08.JRRagDoll.
- This example shows how to use jBullet joints in a model.
- The source code for the jBullet class RagDoll is here.
Part 2. Remarks on jbullet + jReality
Here are some facts you might need to know about how the jbullet package is integrated into jReality:
- You need exactly one instance of PhysicalWorld. This instance contains an instance of a jbullet DynamicsWorld that does the underlying work of physics simulation.
- You can add any number of PhysicalObject's to the instance of PhysicalWorld.
- A physical object consists of a jbullet shape, a jReality SceneGraphComponent, and a sound.
- The jReality geometry used to represent the shape is a faithful representation of the jbullet geometry associated to the shape.
- Sample03PhysicsEngine uses the built-in support for spheres and cubes to create its physical objects.
- See the methods setContent() and alignContent() in PhysicsViewerVRfor an example of how to add arbitrary IndexedFaceSets to the physical world.
- Notice that the current implementation does not support a fully hierarchical scene graph: all physical objects end up being children of the same root node.
- The example JRRagDoll shows how to take an existing jBullet dynamical world and bring it into jReality.
- Keeping the dynamic simulation up to date is accomplished by an instance of the jReality tool PhysicsTimerTool, which is a private class within PhysicalWorld.
Part 3. Assignment
Your assignment, due in two weeks (at 14:00 Uhr Wednesday December 10) is to modify Sample03PhysicsEngine, JRRagDoll, or PhysicsViewerVR in an interesting way. Here are some options:
- Implement a game based on the interaction of rigid bodies:
- Billiards or pool
- Miniature golf
- Make up your own!
- "Upgrade" the rag doll example into a marionette, so that the head, arms, and legs can be controlled by objects positioned above the doll and activated by tools in the scene graph.
- Implement a visual demonstration that the solution to the tautochrone problem is also the solution to the
- Create a thin round cylinder (like a coin), and experiment with its dynamic behavior on a flat surface. Spin it around and see how it falls over, etc.
- Investigate how to integrate the jbullet joint features into the jReality implementation, and carry out some initial part of the task.
- Currently, jbullet calculates the inertia tensor by assuming the coordinate system has already been chosen so the result is diagonal (see JRBulletUtility). Figure out how to ensure that this assumption is true.
- Find out which physical parameters can be varied within jbullet (e.g., mass, elasticity, friction) and adapt Sample03PhysicsEngine to allow all these parameters to be varied.
- Once you've finished your work, check it into the svn repository as directed above. Be sure that you've documented the changes that you've made to the original, or if you've written your own system, document how you've done it.
- Remember, check in your work by 14:00 Uhr (punkt!) on 10.12.08.