Skip to content

About Compound hierarchy question #221

Answered by RossNordby
0xF6 asked this question in Q&A
Discussion options

You must be logged in to vote

A Compound is just a list of children with no acceleration structure, so adding to/removing from it amounts to just modifying the child buffer to be whatever you want.

A BigCompound is built for larger numbers of children, and so has a Tree acceleration structure that will also need to be updated.

static void AddChildToCompound(ref BigCompound compound, CompoundChild child, BufferPool pool, Shapes shapes)
{
    pool.Resize(ref compound.Children, compound.Children.Length + 1, compound.Children.Length);
    compound.Children[^1] = child;
    shapes.UpdateBounds(child.LocalPose, child.ShapeIndex, out var bounds);
    compound.Tree.Add(bounds, pool);
}
static void RemoveChildFromCompoundAt(ref 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@0xF6
Comment options

@RossNordby
Comment options

Answer selected by 0xF6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants