Fringe Physics
Contents |
Project Overview
The concept of this project is to create a room with a physics-enabled ballpit in the center. The user would have the ability to interact with the balls by picking them up and moving them to certain stations. These stations can be anything from antigravity fields and seesaws to trampolines and infintely dense miniplanets, and is solely dependent on the creativity of the individual.
Project Goals
- Integrate the Bullet Engine to OpenSceneGraph by linking the two worlds
- Encapsulate a system of object creation and physics handling
- Enabled user interactions using OSG intersection
- Integrate system with ZSpace for enhanced immersion
Developers
Software Developer
- Robert Maloney
Project Adviser
- Jurgen Schulze
Technologies
- CalVR
- OpenSceneGraph v3.0.1
- Bullet Engine v2.8.1
- ZSpace
Timeline
Basic Scene
The first step was to create a scene with primitive objects for initial testing: a small box for our manipulated object, and a bigger box pushed down by its halflength to serve as our ground. Once this scene was in place, the physics engine had to be integrated.
The Bullet Engine is a completely separate entity from OpenSceneGraph, but both systems have very similar frameworks that allow us to easily connect the two. By making a static box equal to the ground box, and a kinematic box equal to the smaller rendered box, we can simulate physics by synchronizing the matrices of the two worlds. I added a bit more functionality by allowing the physics box to be manipulated by the arrow keys and spacebar, effectively forcing the rendered box to slide and hop.
Once this basic simulation was achieved, the next step was to create a system by which one could generate objects with a few important parameters. This system would completely handle the rendering and updating of its objects by linking the rendered and physical world, and simply return Nodes for adding to the scene. This was created as an ObjectFactory and a BulletHandler. The ObjectFactory creates the object based on the user's preference, and then signals the BulletHandler to create its physical counterpart. Before every frame, the rendered world's matrices are synched with the physical world.
In order to see both the full power of the Bullet Engine and a prototype of the ballpit, I simulated a volume of 400 spheres. Once the simulation has begun, the spheres go into action, dispersing and filling the low end of the scene. An invisible wall has also been implemented to contain the objects in the scene.
Antigravity Field
The next step of the project involved creating the stations. My first station was the antigravity field, because the first thing I wanted to do with a physics engine was defy it. The Antigravity Field revolves around the functionality of a special object in the Bullet Engine, the btGhostObject. It does not create impulses against colliding objects, like the spheres do, but still keeps track of collisions in an AABB.
By attaching a Vec3 to the btGhostObject, I was able to create a basic Antigravity Field. On every frame, the AGFs check for collisions. For all dynamic objects inside the AABB, the AGF's gravity vector is applied. In order to create the illusion of realistic gravity when outside these fields, there is actually an AGF encompassing all the others. Coupling it with a hierarchical algorithm gives us a deterministic way of applying gravity. In future iterations, I am going to change the AGFs to add to gravity instead of write it.
Seesaw
The second station I created was a seesaw, which is quite simple with the Bullet Engine. The engine allows us to define a hinge constraint that limits rotation of the object. In order to abstract from manually defining the hinge vector for each object, the ObjectFactory determines the hinge between the smallest dimensions for x-axis and y-axis.