you said this
Now you should see a platform(tree collider) with three boxes falling on to it.
The green boxes have a convex hull collider and the blue box has a Box collider.
but I see the world being made of:
Box, a compound with a box as a child, a convexhull, and collision tree. is this correct?
if this is the case then this not a case bug this is a function that is not fully implement yet.
if you look at the source in file c:\..\coreLibrary_300\source\physics\dgCollisionCompound.cpp
you will find a series of commented out functions.
In core 200 compound collision was very inefficient when the compound had lot of sub shapes.
The reason was I always assumed that a compound was going to be small, but that was not the case and few people made very big compound shapes that slowed down the broad phase
with many unnecessary call to narrow phase contact calculation.
to give you an idea, a lever and has 100 static boxes.
and one dynamics box. this was realizably efficient is core 200 because the multi grid always reported the number of boxes in close proximity to the dynamics Box, in must case just few pairs.
however say you put the 100 boxes in a compound collision, in core 200 the muti grid reported one pair, but the pair reported 100 sub pairs.
let us not even talk of when we had compound again compounds, it was very bad. Late I added a dynamics sweep and prune to make it better
but that was no always good because sweep a prune is a one dimensional algorithm and finding the best axis was time consuming and not a clear which was the best axis.
In fact it always reported many time over more pair for contact calculation.
In core 300, different flavors of the collision tree construction of core 100 and 200 as the core of all of the broad phase collision.
the collision trees as optimal in the same that a Read Black tree algorithm can produced an optimal balance of a binary tree using tree rotation.
This is in fact the secret of why collision tree is so fast (I actually tried to put that against a self appointed expert in one forum that was bragging about his self re-invented Sweep and prune,
but I was dismissed but the crow and the forum n the ground that Newton was no open source at the time as if that was a crime)
Anyway the algorithm is basically the same as that of red black and avl trees. Essentially what is does is the it takes a tree consisting of a root and it left and right child, and a optimization criteria.
then it calculate all possible permutations of that tree, since there are only tree node, there are only three configurations, for each configuration is calculation the cost (the optimization criteria).
The is the configuration for the lowest cost is different than the current configuration, then it apply that tree rotation and continue to the next node.
There are few criteria you can use, the volume of the AABB of the tree node, the surface area, the euclidian distance. My test show that volume is too big of a value and distance is too small, the surface are is best.
after few passed of the algorithm the tree becomes optimized on the criteria. and not oteh configuration of the same tree can be more optimal.
This is in the same way that a Red Black tree is optimal base of the critical that no tow consecutive node can be red (or black), this lead to a tree when the longer branch in no longer that 2 * log (n)
meaning that a red black tree is no absolute optimal since a absolute optimal binary tree is one where the longer branch is log(n) deep.
However there are not know algorithm that can balance a binary tree to have the cost. therefore Red Black tree are optimal for binary tree.
The same goes for my algorithm, the collision tree is perfect according to the criteria that it is the collision tree the has the smaller possible surface area of all of the combined nodes.
basically the collision tree is a tree when the AABB of any two pair of triangle is the one the smallest surface area.
For years I had being trying to make the algorithm Real time. I always thought that it will be too expensive, since it takes several passes to converge to an optimal criteria so for
a tree with several hundred thousand nodes (some time millions) it was out of the question.
However it occurred to me that not always the number of nodes is as large as in a collision tree, so at least making one pass is not that expensive.
It also occur to me that in a dynamics tree (like the broad phase collisiion ) in general there is lot of coherences, meaning that from updates to updates, the number of leaves nodes move relative to their current position.
so the net cost changes by a small amount.
so for core 300 hundred I decided to generalize the collision tree for Scene collision, the broad phase and compound collision.
To make the algorithm dynamics I borrow from another idea of general programming which is Garbage collected memory management.
basically instead of the broad phase and the dynamic phase of the engine doing the maitanace of these opjects,
each one of these objets have a function called ImproveFitness that is run periodically and does what I explain before.
This is beautiful become it completely decouple the maintenance of the broad phase from the engine
(it can even be placed its own thread and it can even run with multicourse) and it reduce teh number of critical sections, each time a body moves, to almost zero, making the algorithm ideal for dedicated hardware.
so to resume in core 300, the collision tree algorithm is the core of the collision system, it is dynamics,
(this mean that it is possible to add an remove faces and or shape to a collision tree at run time)
this feature will be use for soft bodes meshes made of triangular meshed in the future.
Anyway I will complete those function for the compound and all shoul be fine.