Rebuild
body.rebuild(kind, params, { instances? }) gives an existing body new parameters. The body keeps its ogId, its placement, its parent and its place in your scene. Its shape gets a new revision.
- The kind may change, but a wire stays a wire and a solid a solid. A change of body type throws
BodyTypeMismatch. rebuildreplaces the shape, so an earlieroperateresult is gone. Calloperateagain after it.- A shape shared by instances needs
{ instances: 'all' }, ormakeUnique()first.
Mirror
body.mirror({ origin, normal }, { instances? }) rebuilds the shape as its reflection across the plane through origin with normal normal. Both are in the body’s own coordinates. The normal does not need unit length.
This makes a right chair arm from a copy of the left arm:
- It works on a wire, a sheet or a solid.
- The placement does not change.
- The boolean report is cleared, so
getReport()givesnull. - A zero normal or a coordinate that is not finite throws
InvalidParameter.
InvalidTransform. Use mirror.
