#include <SoCollisionShape.h>
Public Types | |
Public Member Functions | |
virtual SoBaseKit * | copy (SbBool copyConnections) const |
dGeomID | createGeom (const SbMatrix &mm) |
void | getCOG (SbVec3f &cog) |
dGeomID | getGeom () |
dSpaceID | getSpace () |
SbBool | getVisualisationStatus () |
void | setSpace (dSpaceID spaceID) |
SbBool | setUpConnections (SbBool onOff, SbBool doItAlways=FALSE) |
void | setVisualisationStatus (SbBool onOff) |
SoCollisionShape (const SbString &nodeName="") | |
virtual void | updateGeomPosition (const SbMatrix &mm) |
void | updateOIPosition () |
virtual | ~SoCollisionShape () |
Static Public Member Functions | |
static void | initClass () |
static SoCallbackAction::Response | InitCollisionShapesCB (void *userdata, SoCallbackAction *action, const SoNode *node) |
Public Attributes | |
SoSFEnum | alignment |
SoSFBool | autoinitialise |
SoSFUInt32 | category |
SoSFUInt32 | collisionmask |
SoSFEnum | surfaceMaterial |
Protected Member Functions | |
virtual dGeomID | cGeom (const SbMatrix &mm) |
virtual void | updateVisualisationAndOdeProperties () |
Protected Attributes | |
SbVec3f | COG |
SbMatrix | CoinRefTransform |
dGeomID | geometry |
dSpaceID | space |
SoMatrixTransform * | transform |
SoFieldSensor | updateOdePropertiesSensor |
SoSFTrigger | updateOdePropertiesTrigger |
Private Member Functions | |
SO_KIT_CATALOG_ENTRY_HEADER (visualisation) | |
SO_KIT_CATALOG_ENTRY_HEADER (ODETransform) | |
SO_KIT_CATALOG_ENTRY_HEADER (visDrawStyle) | |
SO_KIT_CATALOG_ENTRY_HEADER (separator) | |
SO_KIT_HEADER (SoCollisionShape) | |
Static Private Member Functions | |
static void | UpdateVisualisationAndOdePropertiesCB (void *data, SoSensor *sensor) |
Geometry objects (or ''geoms'' for short) are the fundamental objects in ODEs collision system and can represent a single rigid shape (such as a sphere or box).
Any geom can collide with any other geom which then yields zero or more contact points.
Normally the collision shape is invisible which can be changed by setting the SoCollisionShape::visDrawStyle member to FILLED in the Inventor file of by calling SoCollisionShape::setVisualisationStatus() with TRUE as parameter. This is usefull if a collision object is necessary which does not have to have any physical properties (like a ground plane for example).
See How to create a new IPSA collision shape for detailed instructions on how to create new IPSA collision shapes.
Definition at line 44 of file SoCollisionShape.h.
The different ways the collisionshape can be aligned with the corresponding body.
STANDARD | Keep the collision shape in the same place as it is. |
CENTERED | Align the collision shape with the center of gravity. |
Definition at line 77 of file SoCollisionShape.h.
Enumeration for the different types of surface materials which are used to determine the friction between bodies.
Definition at line 85 of file SoCollisionShape.h.
SoCollisionShape::SoCollisionShape | ( | const SbString & | nodeName = "" |
) |
The constructor of SoCollisionShape.
nodeName | name of the node in the Inventor scenegraph |
Definition at line 330 of file SoCollisionShape.cpp.
References alignment, autoinitialise, category, CENTERED, CLEAN, collisionmask, GLASS, GREASY, RUBBER, STANDARD, STEEL, surfaceMaterial, transform, updateOdePropertiesSensor, UpdateVisualisationAndOdePropertiesCB(), and WOOD.
SoCollisionShape::~SoCollisionShape | ( | ) | [virtual] |
The virtual standard destructor of SoCollisionShape.
Definition at line 437 of file SoCollisionShape.cpp.
References geometry.
dGeomID SoCollisionShape::cGeom | ( | const SbMatrix & | mm | ) | [protected, virtual] |
This method creates a box geom of the given 1/1/1 side lengths, and returns its ID. The point of reference for a box is its center.
mm | the model matrix of the current node |
Reimplemented in SoCollisionShapeBox, SoCollisionShapeCylinder, SoCollisionShapePlane, SoCollisionShapeSphere, and SoCollisionShapeTriMesh.
Definition at line 532 of file SoCollisionShape.cpp.
References space.
Referenced by createGeom().
SoBaseKit * SoCollisionShape::copy | ( | SbBool | copyConnections | ) | const [virtual] |
The overwritten copy() method
copyConnections | copy connections if true |
Reimplemented in SoCollisionShapeBox, SoCollisionShapeCylinder, SoCollisionShapePlane, SoCollisionShapeSphere, and SoCollisionShapeTriMesh.
Definition at line 386 of file SoCollisionShape.cpp.
References COG, CoinRefTransform, geometry, setUpConnections(), space, and transform.
dGeomID SoCollisionShape::createGeom | ( | const SbMatrix & | mm | ) |
On first time invoke: uses the method SoCollisionShape::cGeom() to initialise SoCollisionShape::geometry via ODE if it is NULL. The dGeomID is used to set the body and data on it, Category and Collisionmask are set. Upon all subsequent calls the ODE-geom is NOT reinitialized. Only SoCollisionShape::category and SoCollisionShape::collisionmask are set on SoCollisionShape::geometry. SoCollisionShape::updateVisualisationAndOdeProperties is called if SoCollisionShape::autoinitialise is set to TRUE.
mm | the model matrix of the current node |
Definition at line 485 of file SoCollisionShape.cpp.
References category, cGeom(), collisionmask, geometry, and updateVisualisationAndOdeProperties().
Referenced by InitCollisionShapesCB().
void SoCollisionShape::getCOG | ( | SbVec3f & | COM | ) |
COM | the center of gravity vector is stored in this parameter. |
Definition at line 570 of file SoCollisionShape.cpp.
References COG.
Referenced by SoPhysics::createOdeBody(), and SoPhysics::updateOdeBodyParameters().
dGeomID SoCollisionShape::getGeom | ( | ) |
Returns the dGeomID of the object.
Definition at line 465 of file SoCollisionShape.cpp.
References geometry.
Referenced by SoPhysics::createOdeBody().
SoCollisionShape::getSpace | ( | ) | [inline] |
Definition at line 68 of file SoCollisionShape.h.
SbBool SoCollisionShape::getVisualisationStatus | ( | ) |
Reads the visualisation status and returns it.
Definition at line 544 of file SoCollisionShape.cpp.
void SoCollisionShape::initClass | ( | ) | [static] |
Initialises the class and it's type id variables.
Reimplemented in SoCollisionShapeBox, SoCollisionShapeCylinder, SoCollisionShapePlane, SoCollisionShapeSphere, and SoCollisionShapeTriMesh.
Definition at line 291 of file SoCollisionShape.cpp.
SoCallbackAction::Response SoCollisionShape::InitCollisionShapesCB | ( | void * | userdata, | |
SoCallbackAction * | action, | |||
const SoNode * | node | |||
) | [static] |
This method traverses the Inventor tree and creates the respective ODE-Geom for each SoCollisionShapes-Node. Additionally it calls SoCollisionShape::setUpConnections() on the instance which can not be done in the constructor since the method SoCollisionShape::setUpConnections() is virtual and can not be called safely inside the constructor.
userdata | pointer to an SoWorldPhysics object | |
action | used to get the model matrix of the current node | |
node | node with supertype SoCollisionshape |
Definition at line 308 of file SoCollisionShape.cpp.
References autoinitialise, createGeom(), SoWorldPhysics::ownspace, setSpace(), setUpConnections(), updateGeomPosition(), and updateVisualisationAndOdeProperties().
Referenced by SoWorldPhysics::initialiseWorld().
void SoCollisionShape::setSpace | ( | dSpaceID | spaceID | ) |
SoCollisionShape::setSpace(dSpaceID spaceID) Sets the dSpaceID the collision shape should be created in.
spaceID | the dSpaceID to set |
Definition at line 509 of file SoCollisionShape.cpp.
References space.
Referenced by InitCollisionShapesCB().
SbBool SoCollisionShape::setUpConnections | ( | SbBool | onOff, | |
SbBool | doItAlways = FALSE | |||
) |
Connects the updateOdePropertiesSensor with the updateOdePropertiesTrigger field depending on the parameter onOff.
onOff | attach sensors if TRUE, detach sensors if FALSE | |
doItAlways | always perform attach/detach of sensors if this parameter is TRUE |
Definition at line 410 of file SoCollisionShape.cpp.
References updateOdePropertiesSensor, updateOdePropertiesTrigger, and UpdateVisualisationAndOdePropertiesCB().
Referenced by SoCollisionShapeTriMesh::copy(), SoCollisionShapeSphere::copy(), SoCollisionShapePlane::copy(), SoCollisionShapeCylinder::copy(), SoCollisionShapeBox::copy(), copy(), and InitCollisionShapesCB().
void SoCollisionShape::setVisualisationStatus | ( | SbBool | onOff | ) |
Sets the visibility of the visualisation.
onOff | enables the visualisation if true, disables it otherwise. |
Definition at line 558 of file SoCollisionShape.cpp.
Referenced by SoPhysics::createOdeBody(), and SoPhysics::FieldChangedCB().
SoCollisionShape::SO_KIT_CATALOG_ENTRY_HEADER | ( | visualisation | ) | [private] |
SoCollisionShape::SO_KIT_CATALOG_ENTRY_HEADER | ( | ODETransform | ) | [private] |
SoCollisionShape::SO_KIT_CATALOG_ENTRY_HEADER | ( | visDrawStyle | ) | [private] |
SoCollisionShape::SO_KIT_CATALOG_ENTRY_HEADER | ( | separator | ) | [private] |
SoCollisionShape::SO_KIT_HEADER | ( | SoCollisionShape | ) | [private] |
void SoCollisionShape::updateGeomPosition | ( | const SbMatrix & | mm | ) | [virtual] |
This function sets the ODE transformation from the open inventor transformation and aligns the Inventor visualisation with ODE. It is used for static collisionshapes (geoms without bodies) only.
mm | The open inventor transformation matrix. |
Reimplemented in SoCollisionShapePlane.
Definition at line 598 of file SoCollisionShape.cpp.
References alignment, CENTERED, COG, CoinRefTransform, geometry, and STANDARD.
Referenced by InitCollisionShapesCB().
void SoCollisionShape::updateOIPosition | ( | ) |
This function sets the open inventor position. It may be overridden for derived classed.
Definition at line 636 of file SoCollisionShape.cpp.
References CoinRefTransform, geometry, and transform.
void SoCollisionShape::updateVisualisationAndOdeProperties | ( | ) | [protected, virtual] |
Updates the default visualisation shape of the collsionshape and creates it if it isn't present. There are no properties which need to be updated
Reimplemented in SoCollisionShapeBox, SoCollisionShapeCylinder, SoCollisionShapePlane, SoCollisionShapeSphere, and SoCollisionShapeTriMesh.
Definition at line 450 of file SoCollisionShape.cpp.
Referenced by createGeom(), InitCollisionShapesCB(), and UpdateVisualisationAndOdePropertiesCB().
void SoCollisionShape::UpdateVisualisationAndOdePropertiesCB | ( | void * | data, | |
SoSensor * | sensor | |||
) | [static, private] |
This method is called whenever a size property of the collisionshape changes. It sets the new values on the dependent visualisation shape by calling updateVisualisationAndOdeProperties() on the passed in data object.
data | void pointer to an SoPhysics object on which updateDependentObjects is called | |
sensor | currently unused |
Definition at line 582 of file SoCollisionShape.cpp.
References updateVisualisationAndOdeProperties().
Referenced by setUpConnections(), and SoCollisionShape().
Alignment of current SoCollisionShape (default = SoCollisionShape::STANDARD).
Definition at line 83 of file SoCollisionShape.h.
Referenced by SoCollisionShape(), updateGeomPosition(), and SoPhysics::updateOdeBodyParameters().
If this value is true the SoCollisionShape::updateVisualisationAndOdeProperties() method is called in SoCollisionShape::InitCollisionShapesCB(void*, SoCallbackAction*, const SoNode*).
Definition at line 100 of file SoCollisionShape.h.
Referenced by InitCollisionShapesCB(), and SoCollisionShape().
Current collision category. This is used in ODE to distinguish different object categories for collision.
Definition at line 98 of file SoCollisionShape.h.
Referenced by createGeom(), and SoCollisionShape().
SoCollisionShape::COG [protected] |
The center of gravity (cog) of the collision shape (default = { 0.0f, 0.0f, 0.0f}).
Definition at line 112 of file SoCollisionShape.h.
Referenced by SoCollisionShapeTriMesh::cGeom(), copy(), getCOG(), and updateGeomPosition().
SoCollisionShape::CoinRefTransform [protected] |
Definition at line 109 of file SoCollisionShape.h.
Referenced by copy(), updateGeomPosition(), and updateOIPosition().
Collisionmask used by the ODE engine.
Definition at line 99 of file SoCollisionShape.h.
Referenced by createGeom(), and SoCollisionShape().
dGeomID SoCollisionShape::geometry [protected] |
The ID of the SoCollisionShape object (default = NULL).
Definition at line 111 of file SoCollisionShape.h.
Referenced by copy(), createGeom(), getGeom(), updateGeomPosition(), updateOIPosition(), SoCollisionShapeSphere::updateVisualisationAndOdeProperties(), SoCollisionShapeCylinder::updateVisualisationAndOdeProperties(), SoCollisionShapeBox::updateVisualisationAndOdeProperties(), and ~SoCollisionShape().
SoCollisionShape::space [protected] |
The ID of the ODE space the collision shape is created in.
Definition at line 110 of file SoCollisionShape.h.
Referenced by SoCollisionShapeTriMesh::cGeom(), SoCollisionShapeSphere::cGeom(), SoCollisionShapePlane::cGeom(), SoCollisionShapeCylinder::cGeom(), SoCollisionShapeBox::cGeom(), cGeom(), copy(), and setSpace().
Current surface material for the SoCollisionShape (default = SoCollisionShape::GREASY).
Definition at line 96 of file SoCollisionShape.h.
Referenced by SoWorldPhysics::NearCallback(), and SoCollisionShape().
SoCollisionShape::transform [protected] |
Definition at line 108 of file SoCollisionShape.h.
Referenced by SoCollisionShapePlane::cGeom(), copy(), SoCollisionShape(), and updateOIPosition().
SoCollisionShape::updateOdePropertiesSensor [protected] |
This sensor is attached to SoCollisionShape::updateOdePropertiesTrigger and calls SoCollsisionShape::UpdateVisualisationAndOdePropertiesCB() when the field changes.
Definition at line 107 of file SoCollisionShape.h.
Referenced by setUpConnections(), and SoCollisionShape().
SoCollisionShape::updateOdePropertiesTrigger [protected] |
The SoCollisionShape::updateOdePropertiesSensor is attached to this field to automatically update the ODE propertries and the visualisation shape if any object property changes. To make a property field property1 trigger an update of the visualisation shape use the following code in the constructor:
updateOdePropertiesTrigger.appendConnection(&property1);
Definition at line 106 of file SoCollisionShape.h.
Referenced by setUpConnections(), SoCollisionShapeBox::SoCollisionShapeBox(), SoCollisionShapeCylinder::SoCollisionShapeCylinder(), SoCollisionShapePlane::SoCollisionShapePlane(), SoCollisionShapeSphere::SoCollisionShapeSphere(), and SoCollisionShapeTriMesh::SoCollisionShapeTriMesh().
Generated on Sat Mar 10 20:00:20 2012 for IPSA by 1.5.8 |