Package com.openinventor.inventor.collision
Four new classes are provided to support detection of collisions in Open Inventor.
This method prevents the camera from going through walls or floors, making viewer manipulation much more comfortable and realistic. To use this class, first create a standard viewer and then an SoWinCollisionViewer
(or SoXtCollisionViewer) for this viewer. Collision detection will be activated immediately. The minimum distance between the camera and the object can be tuned. A user callback function can be set to receive notification when a collision is detected. See SoWinCollisionViewer
(or SoXtCollisionViewer) for more information. A program demonstrates how to use this class: $OIVHOME/examples/source/Inventor/examples/Features/Collision/CollisionViewer
SoDualSceneCollider
performs very fast collision detection for the case of two scene graphs, one static, and one moving. This class is designed to detect collisions between very large scenes (i.e., containing millions of triangles) while still allowing interactive display of the two scenes. You can retrieve information about colliding triangles, coordinates of common points, and so forth. This is useful, for example, for walk-through of a complex factory environment.
The following program demonstrates how to use this class:
$OIVHOME/examples/source/Inventor/examples/Features/Collision/SceneCollider/DemoCollider.cxx
This class is an Open Inventor action. It allows programmers to analyze a complete scene graph to detect intersection between shapes. The action first detects intersection between bounding boxes. If an intersection exists between two shapes, the action calls a user filter function. This function can stop the collision detection process for these two shapes.
The second step of the intersection detection mechanism consists of comparing each triangle of both shapes. If a triangle collision is found, the action calls the user callbacks. Each callback is able to inform the action if it is interested in the next collision report. It can be informed of the intersection for the next graphic primitive or only for the next shape or it can just say that it is not interested in the next intersection. Intersections are detected even if objects are not visible or pickable. See SoIntersectionDetectionAction
for more information. A program demonstrates how to use this class: $OIVHOME/examples/source/Inventor/examples/Features/Collision/Intersections
This class is deprecated and SoDualSceneCollider
should be used instead.
This class is useful for monitoring the transformations of an object relative to a scene graph. It can prevent this object from colliding with other shapes in the scene, or it can glue the object to the surface of the shapes it is colliding with, or it can just call a user callback function. The gluing process tries to find the closest position where the objects do not collide. The number of positions to try can be tuned. Collision detection can be computed only on bounding boxes for the object or for all of the shapes in the scene. When a bounding box collision occurs between two shapes, a user filter function is called. This function can stop the detection process for these two shapes.
The second step of the collision detection mechanism consists of comparing each triangle of both shapes. If a triangle collision is found, the collision manager calls the user callbacks. Each callback can inform the manager if it is interested in the next collision report for the current transformation. It can be informed of the collision for the next graphic primitive (e.g. triangle or line segment) or only for the next shape or it can just say that it is not interested in the next collision reports for the current transformation. Collisions are detected even if objects are not visible or pickable. See SoCollisionManager
for more information. Two programs demonstrate how to use this class: $OIVHOME/examples/source/Inventor/examples/Features/Collision/Dart and $OIVHOME/examples/source/Inventor/examples/Features/Collision/ObjectMoving
-
Interface Summary Interface Description SoCollisionManager.BBoxCollisionListener Bounding box collision callbacks are called after the bounding box collision detection and before real detection, allowing the programmer to change theSoCollisionManager.CollisionListener Collision callbacks are called when there is a collision.SoCollisionManager.Filter Filter callback is called when an object shape collides with a scene shape. -
Class Summary Class Description SoCollidingPrimitive SoCollisionManager Class to manage collisions.SoCollisionManager.CollidingPrimitive Vertices array can contains 2 or 3 elements whether primitive is a segment or a triangle.SoDualSceneCollider Class to check for collisions between two scenes.SoIntersectingPrimitive SoIntersectionDetectionAction Class to detect intersections. -
Enum Summary Enum Description SoCollidingPrimitive.PrimitiveTypes Primitive type.SoCollisionManager.Axis Axis.SoCollisionManager.Positions Postion.SoCollisionManager.Resps Types definitions.SoCollisionManager.TransformChangeTypes Transform change type.SoIntersectingPrimitive.PrimitiveTypes Primitive type.SoIntersectionDetectionAction.Axis Axis.SoIntersectionDetectionAction.Positions Position.SoIntersectionDetectionAction.Resps Types definitions.