
The C++ code of the IPSA Coin wrapper of the ODE physics library has been significantly modified and made available through Python.
This lets you create Coin scenegraph nodes that have physical properties, and then run a simulation directly within the viewer window.
The simulation can be stopped, and Coin manipulators can be used to rearrange the scene, and then the simulation can be restarted.
The scene shown here was generated by a Python port of the dosenwerfen demo program that came with IPSA.
Here is the ASCII Inventor scene file:
#Inventor V2.1 ascii
Separator {
SoWorldPhysics {
fields [ SFEnum renderCaching, SFEnum boundingBoxCaching,
SFEnum renderCulling, SFEnum pickCulling, SFVec3f gravity, SFFloat
ERP, SFFloat CFM, SFFloat autoDisableLinearThreshold, SFFloat
autoDisableAngularThreshold, SFFloat autoDisableTime, SFInt32
autoDisableSteps, SFInt32 autoDisableFlag, SFFloat
contactMaxCorrectingVel, SFFloat contactSurfaceLayerDepth, SFBool
update, SFBool run, SFFloat stepsize, SFEnum stepping, SFInt32
sf1maxiterations ]
gravity 0 -9.8100004 0
stepping QUICKSTEP
DEF ground_plane SoPhysicsPlane {
values 0 1 0 0
}
Coordinate3 {
point [ -1000 0 1000,
1000 0 1000,
1000 0 -1000,
-1000 0 -1000 ]
}
FaceSet {
}
Transform {
translation 0 3 0
}
Separator {
Transform {
translation -3.75 3 10
}
Material {
diffuseColor 1 0 0
}
DEF physics_box0 SoPhysicsBox {
fields [ SFFloat mass, SFVec3f linVelocity, SFVec3f
angVelocity, MFVec3f torqueField, MFVec3f forceField, MFVec3f
forcePos, MFVec3f inertia, SFBool update, SFVec3f scale, SFVec3f
dimension, SFNode callbackList, SFNode reset, SFNode ODETransform,
SFNode collisionShape, SFNode object, SFNode separator ]
mass 2
inertia [ 0.40000001 0 0,
0 0.40000001 0,
0 0 0.40000001 ]
ODETransform
Transform {
translation 0 0 0 =
DEF +0 SoPhysicsEngine {
fields [ SFTime timeIn ]
} . translation_output
rotation 0 0 1 0 =
USE +0 . rotation_output
}
collisionShape
DEF collision_shape_for_physics_box0 SoCollisionShapeBox {
fields [ SFBool update, SFVec3f dimension ]
dimension 2 2 2
}
object
DEF +1 Cube {
}
}
DEF +2 Transform {
translation 2.5 0 0
}
DEF physics_box1 SoPhysicsBox {
fields [ SFFloat mass, SFVec3f linVelocity, SFVec3f
angVelocity, MFVec3f torqueField, MFVec3f forceField, MFVec3f
forcePos, MFVec3f inertia, SFBool update, SFVec3f scale, SFVec3f
dimension, SFNode callbackList, SFNode reset, SFNode ODETransform,
SFNode collisionShape, SFNode object, SFNode separator ]
mass 2
inertia [ 0.40000001 0 0,
0 0.40000001 0,
0 0 0.40000001 ]
ODETransform
Transform {
translation 0 0 0 =
DEF +3 SoPhysicsEngine {
fields [ SFTime timeIn ]
} . translation_output
rotation 0 0 1 0 =
USE +3 . rotation_output
}
collisionShape
DEF collision_shape_for_physics_box1 SoCollisionShapeBox {
fields [ SFBool update, SFVec3f dimension ]
dimension 2 2 2
}
object
USE +1
}
USE +2
DEF physics_box2 SoPhysicsBox {
fields [ SFFloat mass, SFVec3f linVelocity, SFVec3f
angVelocity, MFVec3f torqueField, MFVec3f forceField, MFVec3f
forcePos, MFVec3f inertia, SFBool update, SFVec3f scale, SFVec3f
dimension, SFNode callbackList, SFNode reset, SFNode ODETransform,
SFNode collisionShape, SFNode object, SFNode separator ]
mass 2
inertia [ 0.40000001 0 0,
0 0.40000001 0,
0 0 0.40000001 ]
ODETransform
Transform {
translation 0 0 0 =
DEF +4 SoPhysicsEngine {
fields [ SFTime timeIn ]
} . translation_output
rotation 0 0 1 0 =
USE +4 . rotation_output
}
collisionShape
DEF collision_shape_for_physics_box2 SoCollisionShapeBox {
fields [ SFBool update, SFVec3f dimension ]
dimension 2 2 2
}
object
USE +1
}
USE +2
Transform {
translation -6.25 2.0999999 0
}
DEF physics_box3 SoPhysicsBox {
fields [ SFFloat mass, SFVec3f linVelocity, SFVec3f
angVelocity, MFVec3f torqueField, MFVec3f forceField, MFVec3f
forcePos, MFVec3f inertia, SFBool update, SFVec3f scale, SFVec3f
dimension, SFNode callbackList, SFNode reset, SFNode ODETransform,
SFNode collisionShape, SFNode object, SFNode separator ]
mass 2
inertia [ 0.40000001 0 0,
0 0.40000001 0,
0 0 0.40000001 ]
ODETransform
Transform {
translation 0 0 0 =
DEF +5 SoPhysicsEngine {
fields [ SFTime timeIn ]
} . translation_output
rotation 0 0 1 0 =
USE +5 . rotation_output
}
collisionShape
DEF collision_shape_for_physics_box3 SoCollisionShapeBox {
fields [ SFBool update, SFVec3f dimension ]
dimension 2 2 2
}
object
USE +1
}
USE +2
DEF physics_box4 SoPhysicsBox {
fields [ SFFloat mass, SFVec3f linVelocity, SFVec3f
angVelocity, MFVec3f torqueField, MFVec3f forceField, MFVec3f
forcePos, MFVec3f inertia, SFBool update, SFVec3f scale, SFVec3f
dimension, SFNode callbackList, SFNode reset, SFNode ODETransform,
SFNode collisionShape, SFNode object, SFNode separator ]
mass 2
inertia [ 0.40000001 0 0,
0 0.40000001 0,
0 0 0.40000001 ]
ODETransform
Transform {
translation 0 0 0 =
DEF +6 SoPhysicsEngine {
fields [ SFTime timeIn ]
} . translation_output
rotation 0 0 1 0 =
USE +6 . rotation_output
}
collisionShape
DEF collision_shape_for_physics_box4 SoCollisionShapeBox {
fields [ SFBool update, SFVec3f dimension ]
dimension 2 2 2
}
object
USE +1
}
USE +2
Transform {
translation -3.75 2.0999999 0
}
DEF physics_box5 SoPhysicsBox {
fields [ SFFloat mass, SFVec3f linVelocity, SFVec3f
angVelocity, MFVec3f torqueField, MFVec3f forceField, MFVec3f
forcePos, MFVec3f inertia, SFBool update, SFVec3f scale, SFVec3f
dimension, SFNode callbackList, SFNode reset, SFNode ODETransform,
SFNode collisionShape, SFNode object, SFNode separator ]
mass 2
inertia [ 0.40000001 0 0,
0 0.40000001 0,
0 0 0.40000001 ]
ODETransform
Transform {
translation 0 0 0 =
DEF +7 SoPhysicsEngine {
fields [ SFTime timeIn ]
} . translation_output
rotation 0 0 1 0 =
USE +7 . rotation_output
}
collisionShape
DEF collision_shape_for_physics_box5 SoCollisionShapeBox {
fields [ SFBool update, SFVec3f dimension ]
dimension 2 2 2
}
object
USE +1
}
USE +2
Transform {
translation -1.25 2.0999999 0
}
}
}
EventCallback {
}
}