Method AddCompound
- Namespace
- Box3D
- Assembly
- Box3D.NET.dll
AddCompound(CompoundGeometry, ShapeDefinition?)
Attaches a baked compound to this body, which must be static.
public Shape AddCompound(CompoundGeometry compound, ShapeDefinition? definition = null)Parameters
compoundCompoundGeometry-
The compound. It is not copied, so it must outlive this shape.
definitionShapeDefinition?-
The shape settings, or null for the defaults.
Returns
- Shape
-
The new shape.
Examples
using CompoundGeometry wall = new CompoundBuilder()
.AddHull(rock, new Vector3(0.0f, 0.5f, 0.0f))
.AddHull(rock, new Vector3(1.0f, 0.5f, 0.0f))
.Build();
Body scenery = world.CreateStaticBody();
scenery.AddCompound(wall);
Remarks
The whole compound arrives as one shape, with one filter and one set of events; the per-child materials were fixed when it was baked. For several shapes that can be told apart, or on a body that moves, attach them one at a time instead.
Exceptions
- ArgumentNullException
-
compoundis null. - ObjectDisposedException
-
compoundhas been disposed. - InvalidOperationException
-
This body is not static.