#include <H3DNetworkingUtils/CollisionGeometry.h>
Public Member Functions | |
CollisionGeometry () | |
Constructor. | |
virtual void | initialize () |
Initialize. | |
virtual void | setDyn (CollidableDynamic *ptr) |
Set the Dynamic that contai9ns this CollisionGeometry. | |
CollidableDynamic * | getDyn () |
Get the Dynamic that contai9ns this CollisionGeometry. | |
H3D::Matrix4f | getLocalToGlobal () |
Return a matrfix to convert local to global coords. | |
H3D::Matrix4f | getGlobalToLocal () |
Return a matrfix to convert global to local coords. | |
H3D::Vec3f | getLocalPosition () |
Get the local center position. | |
H3D::Vec3f | getGlobalPosition () |
Get the global center position. | |
virtual CollisionGeometry * | clone () |
Create a CollisionGeometry (can be overridden). | |
virtual void | copy (CollisionGeometry *newP) |
Copy contents into newP. | |
void | setLayer (u_int l) |
Set the hierarchy layer of this geometry. | |
void | setLocalOffset (H3D::Vec3f offs) |
Set the offset of the bounding sphere within the coordin system of the object. | |
Static Public Attributes | |
static H3D::H3DNodeDatabase | database |
Datbase. |
The CollisionGroup class contains the algorithm for testing collisions between CollidableDynamic nodes.
The transform of this node provides the coordinate system of the object. Within that the points of the object it surrounds may not be centered on this, in that case the local_offset is displaced from the origin.
It holds 2 lists, collidingChildrenA and collidingChildrenB. It checks for inter-object collision between each object in collidingChildrenA against each object in collidingChildrenB. Objects can be in both groups. An object is not checked against itself. This collision testing uses the collidables field of each CollidableDynamic in the lists. The collidables field holds a hierarchy of CollidableSpheres in layers. For each layer, the spheres are checked for intersection, and if they intersect, the spheres in the next layer are then checked. If two spheres in the loweest layer intersect, the amount of intersection along with the CollidableDynamics' current momentum, are used to apply forces to both CollidabelDynamics to represent the reaction to the collision. Once two spheres in the hierarchy have been found to collide, no more spheres are tested. This algorithm is designed to provide an approximate, but efficient collision mechanism. However if the system frame rate is found to be too slow, it may be due to having too many CollidableSpheres in the hierarchies of the CollidableDynamics. TO solve this, the collidabl;eDynamic's collisionResolution field should be increased.
Examples:
void H3DNetworkingUtils::CollisionGeometry::setLocalOffset | ( | H3D::Vec3f | offs | ) | [inline] |
Set the offset of the bounding sphere within the coordin system of the object.
This may be different if the points are not distributed around the origin.