I am trying to add physics to an open source solid modeling software : BRL-CAD . The aim is to allow objects to fall to the ground under gravity.
BRL-CAD represents objects in a pure mathematical sense. So a sphere is just a radius and center point. It does not try to approximate it using triangles etc because the software is not required to render the shapes in real time. Rendering occurs using raytracing which can use the mathematical information about the geometry of the object.
So I cannot create exact collision shape geometry in Bullet to match the geometry represented by BRL-CAD. A sphere is a simple case, but more complex shapes can exists such as a Boolean operation of say a Cube subtracted from another bigger cube, thus removing a chunk of it. So the geometry information is accessed using handles to the representation in BRL-CAD structures.
Therefore Bullet knows nothing but the AABBs of the shapes and can only detect their overlaps. Exact contact points is generated using custom overlap detection and contact manifold generation of tools from BRL-CAD.
The way I plan to use Bullet for this is initially create a collision shape using btBoxShape and set its AABB to what I want. This is because I cannot just create AABBs without specifying some collision shape. However during the simulation I need to get a callback that allows me to modify the contact points and normals as the actual geometry inside the AABB may not be a box, but a sphere.
So if we take the simple case of say a sphere of 1m falling to a ground plane on the xz plane from a height of 50m above the origin, then I would "create" this sphere using a btBoxShape in Bullet because as far as bullet is concerned it knows nothing but the AABB of the geometry. When this shape hits the ground plane, then bullet would generate points all along the bottom face of the box.
However I want the contact point to be reset to the single point(assuming there is no interpenetration yet) at the bottom of the sphere which actually makes contact and whose shape the rigid body actually represents.
So my question is (finally!) as follows :
* is it possible to register custom manifold generation algorithms with bullet, such that I can reset the contact points using geometry information that only I have and bullet does not
* If I do reset the contact points and normals, then will bullet recalculate the forces between the sphere and the object automatically, or can I register custom algos to set the force direction, and let bullet handle only the resulting acceleration.