Scenegraph
Scenegraph Nodes - all implement a run function Leaf/Geo Nodes - typedefs of sgNode superclass –Poly Mesh A geo node that stores a list of vertices, and a list of the polygons that these verts create Draws the polymesh when RUN –Primitive A geo node that draws basic primitive geometry. Only Cube implemented so far. –Collision Object A leaf node that stores a BVH of collision geometry, and also a geo node Updates the collision geometries global position when RUN, and also runs the geo node
Group Nodes - child class of sgNode –Transform (static) Base transform node class. Stores a list of child sgNodes (seperated into Leaf/Geo and Group children, so that leaves children are run first) Applies its transformations and then runs all the children when RUN –Animated Transform Linearly interpolates through a preset list of value/timestamp pairs based on the game clock. Updates the node’s transformation values before applying them in the normal run function, as above. –Dynamic Transform Transform node subclass that uses physical responses to change its transformation values Stores a list of impulse forces that were generated in the previous frame from collisions between its sgCollisionObj children and other collidable leaf nodes. When RUN it updates the transformation values using the impulse forces, a preset global force, and its other dynamics values, such as momentum and velocity.
Collision Detection & Physical Response
Collision Detection Collision Tree –Stores a hierarchy of collision nodes –Used by sgCollisionObj as the link into the collision system Collision Node –Stores pointers to all its children nodes –Leaf nodes simply have no children - these are the collNodes whose collision counts as physical contact –Store a position relative to the root of the tree, so that their global position can be found easily –Contains the collision primitive that represents this node in space Collision Primitive –Defines how the collision check is handled - can be overloaded to be any kind of bounding volume in the future –So far Sphere and Plane have been implemented Collision Manager –Stores all of the BVH collision trees in the scene –After scenegraph updates the collision trees’ global positions, they are all checked against one another (static collision check) –Stores list of collision events generated from these collision checks
Physical Response Collision Event –Stores information about a collision, such as the objects involved and the global position of the event –Could be extended in the future to handle collisions between different objects differently Impulse Force –Generated by Collision Events using information about the objects involved –Forces are added to the list of forces in the dyamic transform nodes of the objects that collided. These forces are used next frame to calculate the new position, rotation, velocity and momentum. –If one or both of the objects is not dynamic, it is assumed to be massively heavy, and the impulse force is not applied to it
Future Improvements More user friendly methods for runtime creation, editing, and destruction of the scenegraph and collision tree nodes. Collision Detection handled dynamically rather than statically Different collision primitive types (OOBBs) More accurate physics calculations (lack of inertia tensor) Better graphics and openGL wrapper Optimization (with display lists and overall structuring) Many more features…